{"id":22253661,"url":"https://github.com/nitrokey/se05x","last_synced_at":"2025-10-13T11:31:32.984Z","repository":{"id":188931354,"uuid":"679265155","full_name":"Nitrokey/se05x","owner":"Nitrokey","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-25T09:10:29.000Z","size":268,"stargazers_count":4,"open_issues_count":3,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-09-25T10:29:12.951Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/Nitrokey.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSES/CC0-1.0.txt","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-16T13:06:22.000Z","updated_at":"2025-09-25T08:54:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"9d9e7afe-2951-4de9-a8c0-7dd4597ef463","html_url":"https://github.com/Nitrokey/se05x","commit_stats":null,"previous_names":["nitrokey/se05x"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/Nitrokey/se05x","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitrokey%2Fse05x","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitrokey%2Fse05x/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitrokey%2Fse05x/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitrokey%2Fse05x/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nitrokey","download_url":"https://codeload.github.com/Nitrokey/se05x/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitrokey%2Fse05x/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014793,"owners_count":26085594,"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-10-13T02:00:06.723Z","response_time":61,"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":[],"created_at":"2024-12-03T07:19:22.122Z","updated_at":"2025-10-13T11:31:32.979Z","avatar_url":"https://github.com/Nitrokey.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- Copyright (C) 2023 Nitrokey GmbH --\u003e\n\u003c!-- SPDX-License-Identifier: LGPL-3.0-only --\u003e\n\nSE05X driver\n===========\n\nThis crate contains a Rust driver for the SE05x series of secure elements from NXP.\nIt contains an implementation of the T=1 protocol and the ISO7816-4 APDUs that are used to communicate with the se05x.\n\n```rust,no_run\nuse se05x::se05x::commands::*;\nuse se05x::se05x::policies::*;\nuse se05x::se05x::*;\nlet i2c = get_i2c();\nlet delay = get_delay();\nlet address = 0x48;\nlet mut se05x = Se05X::new(i2c, address, delay);\nlet user_id = ObjectId([0x01, 0x00, 0x00, 0x00]);\nlet object_id = ObjectId([0x01, 0x02, 0x03, 0x04]);\nlet buf = \u0026mut [0; 128];\n\nlet atr = se05x.enable();\n\n// Running a WriteUserId command:\nse05x.run_command(\n    \u0026WriteUserId::builder()\n        .object_id(user_id)\n        .data(b\"Some value\")\n        .build(),\n    buf,\n)?;\n\n// Creating a file with a policy\nlet policy = \u0026[Policy {\n    object_id: user_id,\n    access_rule: ObjectAccessRule::from_flags(ObjectPolicyFlags::ALLOW_READ),\n}];\n\nse05x.run_command(\n    \u0026WriteBinary::builder()\n        .policy(PolicySet(policy))\n        .object_id(object_id)\n        .file_length(9.into())\n        .data(b\"Some data\")\n        .build(),\n    buf,\n)?;\n\n// Opening a session with teh UserID\nlet session_id = se05x\n    .run_command(\u0026CreateSession { object_id: user_id }, buf)?\n    .session_id;\n\n// Verifying the UserId\nse05x.run_session_command(\n    session_id,\n    \u0026VerifySessionUserId {\n        user_id: b\"Some value\",\n    },\n    buf,\n)?;\n// Reading the data with the verified session\nlet data = se05x.run_session_command(\n    session_id,\n    \u0026ReadObject::builder()\n        .object_id(object_id)\n        .offset(0.into())\n        .length(9.into())\n        .build(),\n    buf,\n)?;\n```\n\nArchitecture\n------------\n\n### T=1\n\nThis driver communicates with the se05x over the T=1 protocol over I2C, as described in [UM11225](https://www.nxp.com/webapp/Download?colCode=UM11225).\n\nTo do so and be compatible with most embedded controlers, it depends on the I2C [Read](https://docs.rs/embedded-hal/latest/embedded_hal/blocking/i2c/trait.Read.html) and [Write](https://docs.rs/embedded-hal/latest/embedded_hal/blocking/i2c/trait.Write.html) from [embedded-hal](https://docs.rs/embedded-hal/latest/embedded_hal).\n\n#### Embedded HAL v0.2\n\nThe traits do not expose the protocol enough, as the T=1 protocol requires detecting I2C NACKs, which are not exposed in this version.\n\nNacks are exposed in the `Error` types for each `HAL` crate. As such an extension to the embedded-hal traits is defined as `I2CErrorNack`, exposing the missing information.\nIt is implemented for the NRF and LPC55 Hals in `src/t1/i2cimpl.rs`, gated by the features `nrf` and `lpc55` respectively.\n\n#### Embedded HAL v1.0\n\nThis version exposes the required I2C NACKs. There is no need to use the `nrf` and `lpc55` features.\n\n### Iso7816\n\nThis driver uses the [`iso7816`](https://docs.rs/iso7816/latest/iso7816/) crate to implement serialization of APDUs.\n\n### Generation of commands\n\nTo simplify implementation, all supported se05x APDUs are described in `src/se05x/commands.toml`.\nThe python script `generate_commands.py` parses the `command.toml` file and generates `src/se05x/commands.rs`, which implements all the APDUs.\n\nFunding\n-------\n\n[\u003cimg src=\"https://nlnet.nl/logo/banner.svg\" width=\"200\" alt=\"Logo NLnet: abstract logo of four people seen from above\" hspace=\"20\"\u003e](https://nlnet.nl/)\n[\u003cimg src=\"https://nlnet.nl/image/logos/NGIAssure_tag.svg\" width=\"200\" alt=\"Logo NGI Assure: letterlogo shaped like a tag\" hspace=\"20\"\u003e](https://nlnet.nl/assure/)\n\nThis project was funded through the [NGI Assure](https://nlnet.nl/assure/) Fund, a fund established by [NLnet](https://nlnet.nl/) with financial support from the European Commission's [Next Generation Internet programme](https://ngi.eu/), under the aegis of DG Communications Networks, Content and Technology under grant agreement No 957073.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitrokey%2Fse05x","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnitrokey%2Fse05x","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitrokey%2Fse05x/lists"}