{"id":18080716,"url":"https://github.com/omaraflak/apdu-library","last_synced_at":"2025-08-23T01:12:43.933Z","repository":{"id":82863355,"uuid":"136602718","full_name":"omaraflak/APDU-Library","owner":"omaraflak","description":"Library built on top of libNfc to easily send APDU commands.","archived":false,"fork":false,"pushed_at":"2019-09-30T09:21:24.000Z","size":15,"stargazers_count":20,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T14:22:57.311Z","etag":null,"topics":["android","android-hce","hce","libnfc","nfc","pn532"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omaraflak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-08T10:10:35.000Z","updated_at":"2024-11-14T22:55:22.000Z","dependencies_parsed_at":"2023-03-02T04:45:53.404Z","dependency_job_id":null,"html_url":"https://github.com/omaraflak/APDU-Library","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/omaraflak/APDU-Library","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omaraflak%2FAPDU-Library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omaraflak%2FAPDU-Library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omaraflak%2FAPDU-Library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omaraflak%2FAPDU-Library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omaraflak","download_url":"https://codeload.github.com/omaraflak/APDU-Library/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omaraflak%2FAPDU-Library/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271727846,"owners_count":24810563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-hce","hce","libnfc","nfc","pn532"],"created_at":"2024-10-31T13:09:33.234Z","updated_at":"2025-08-23T01:12:43.924Z","avatar_url":"https://github.com/omaraflak.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# APDU Library\n\nLibrary built on top of libNfc, that allows to easily send APDU commands through a terminal.\n\n# Compile\n\nEnter the repo directory then simply :\n\n```\nmake\n```\n\n# Dependency : Libnfc\n\nThis code uses [libnfc](https://github.com/nfc-tools/libnfc)\n\nIf you're on Linux, you can install libnfc simply by doing :\n\n```\ngit clone https://github.com/nfc-tools/libnfc.git\nautoreconf -vis\n./configure --enable-doc\nmake\nsudo make install\n```\n\n# Notice\n\nThe code contains an implementation of the APDU protocol according to [Wikipedia](https://fr.wikipedia.org/wiki/Application_Protocol_Data_Unit).\nHowever, I'm not entierly sure if I implemented correctly the **extended apdu** protocol. The `PN532` doesn't support it anyway...\n\n# How to use\n\nUse the `NfcManager` to simplify the process of detecting, opening and transceiving data.\n\n```c++\nNfcManager manager;\nif(manager.open()){\n    if(manager.isTargetPresent()){\n        // do things ...\n    }\n    manager.close();\n}\n```\n\nOnce the device opened, use the `APDU` class to send and receive APDUs commands.\nIf you want to perform a **select** command, you would do :\n\n```c++\nAPDU apdu;\napdu.setClass(0x00);\napdu.setInstruction(0xA4);\napdu.setParams(0x04, 0x00);\napdu.setCmd(hexStringToByteArray(appId));\napdu.buildAPDU();\nmanager.transceive(apdu);\n```\n\nTo know more about APDUs instruction codes etc, read the beautiful [ISO standard](http://cardwerk.com/smart-card-standard-iso7816-4-section-5-basic-organizations)\n\nWhen `manager.transceive()` ends, the `APDU` object will contain the response, if any. You can get it like this :\n\n```c++\nstd::vector\u003cuint8_t\u003e responseBytes = apdu.getRespBytes();\nstd::string responseString = apdu.getRespString();\n```\n\nThat said, `NfcManager` already implements the `select` command, you just need to do this :\n\n```c++\nmanager.selectApplication(appId, apdu);\n```\n\n# Examples\n\nYou can find a full examples **[here](https://github.com/OmarAflak/APDU-Library/blob/master/examples)**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomaraflak%2Fapdu-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomaraflak%2Fapdu-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomaraflak%2Fapdu-library/lists"}