{"id":27245857,"url":"https://github.com/stargate01/pyglobalplatform","last_synced_at":"2026-01-20T09:04:06.597Z","repository":{"id":283961889,"uuid":"953395176","full_name":"StarGate01/pyglobalplatform","owner":"StarGate01","description":"High-level API and Swig Python binding for the globalplatform library","archived":false,"fork":false,"pushed_at":"2025-08-08T07:56:43.000Z","size":46,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T12:49:16.348Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StarGate01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-03-23T09:06:48.000Z","updated_at":"2025-05-27T02:05:25.000Z","dependencies_parsed_at":"2025-03-23T11:18:39.674Z","dependency_job_id":"4d172c8c-1f8a-4b4b-8c5d-f3eb35a9ce3f","html_url":"https://github.com/StarGate01/pyglobalplatform","commit_stats":null,"previous_names":["stargate01/pyglobalplatform"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/StarGate01/pyglobalplatform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarGate01%2Fpyglobalplatform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarGate01%2Fpyglobalplatform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarGate01%2Fpyglobalplatform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarGate01%2Fpyglobalplatform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StarGate01","download_url":"https://codeload.github.com/StarGate01/pyglobalplatform/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarGate01%2Fpyglobalplatform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28599850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T08:51:33.170Z","status":"ssl_error","status_checked_at":"2026-01-20T08:51:10.855Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2025-04-10T21:29:38.822Z","updated_at":"2026-01-20T09:04:06.590Z","avatar_url":"https://github.com/StarGate01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pylobalplatform\n\nHigh-level API and Swig Python binding for the GlobalPlatform (https://github.com/kaoh/globalplatform) library.\n\nNot to be confused with https://github.com/JavaCardOS/pyGlobalPlatform , which is widely out of date.\n\n## Requirements\n\nCurrently, only Linux is supported by the build system.\n\nPython 3 with `setuptools`, a C toolchain, `swig`, and `pkg-config` need to be available.\n\nThe `pcsclite` and `globalplatform` libraries need to be available via pkg-config.\n\n## Installation\n\n`pip install .`\n\n## Usage\n\nThe library is split into two parts: The native library adapter `globalplatform.native` which closely mirrors the interface of the upstream `globalplatform` C API, and the higher-level library `globalplatform.shell`, which follows the semantics of the upstream `gpshell` tool.\n\n### High-level shell\n\nThe high-level shell handles memory management and does proper marshalling of all python types. It still uses `bytearray()` internally, but no longer does modifications in ByRef-passed buffers - instead the actual results are properly returned.\n\nThe class `GP211Shell` implements a subset of the `gpshell` supported commands for GP 2.1.1 , and follows the same semantics.\n\n```python\nfrom globalplatform import shell, native\n\ngps = shell.GP211Shell()\n\ngps.establish_context()\ngps.card_connect(\"your reader\")\n\ngps.select(shell.ISD_AID)\nkeySet = shell.KeySet.plain() # Default keys\ngps.open_sc(keySet, securityLevel = native.GP211_SCP02_SECURITY_LEVEL_C_DEC_C_MAC_R_MAC)\n\ngps.install(\"applet.cap\")\n\nprint(gps.get_status())\n\ngps.card_disconnect()\ngps.release_context()\n```\n\n### Native adapter\n\nSince this is just an autogenerated SWIG wrapper, the API is the same as for the C `globalplatform` one.\n\nAll `PBYTE` and `BYTE*` (`unsigned char *`) buffer pointers are marshalled to Python as mutable `bytearray()`. Fixed-size `BYTE[N]` arrays are also marshalled as `bytearray()`, but their length constraints are enforced. `OPGP_STRING` is marshalled the same as `PBYTE`, `OPGP_CSTRING` is treated as a readonly input string.\n\nPointer function helpers are generated for `DWORD`, which enable handling `PDWORD` pointers.\n\nAll functions which return a `OPGP_ERROR_STATUS` result are checked, and a `OPGPError` Exception is raised if the status requires it.\n\nArray helper functions are generated for the structs `GP211_APPLICATION_DATA`, `GP211_EXECUTABLE_MODULES_DATA`, and `OPGP_AID`.\n\nThe wrapper is compiled with threading support, such that the Python GIL is released when library functions are entered.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstargate01%2Fpyglobalplatform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstargate01%2Fpyglobalplatform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstargate01%2Fpyglobalplatform/lists"}