Skip to content

Comments

Add native Python GlobalPlatform runner and wire into run_globalplatform#277

Open
3rdIteration wants to merge 1 commit intodevfrom
codex/implement-globalplatformpro-functionality-in-python
Open

Add native Python GlobalPlatform runner and wire into run_globalplatform#277
3rdIteration wants to merge 1 commit intodevfrom
codex/implement-globalplatformpro-functionality-in-python

Conversation

@3rdIteration
Copy link
Owner

Motivation

  • Replace the external gp.jar shell invocation with a native Python implementation to allow running GlobalPlatform operations without launching Java subprocesses.
  • Provide a direct pyGlobalPlatform/libglobalplatform-backed path for install/delete/list/secure-channel key operations used by the applet tools.

Description

  • Added src/seedsigner/helpers/globalplatform_native.py which implements GlobalPlatformNativeRunner and a _PyGlobalPlatformBackend that maps a subset of GlobalPlatformPro-style CLI commands (-l -v, --install, --create, --params, --delete, --unlock, --lock) to pyGlobalPlatform API calls and PC/SC actions.
  • Updated run_globalplatform in src/seedsigner/helpers/seedkeeper_utils.py to call GlobalPlatformNativeRunner().run(command) and preserve the previous UI behaviour, PN532 restart handling, and user-facing error mapping.
  • The native backend opens PC/SC context, selects a reader/card, performs SCP02 mutual authentication (default or provided keys), and executes load/installForInstallAndMakeSelectable/deleteApplication/putSCKey operations via the pyGlobalPlatform binding.
  • Added focused unit tests tests/test_globalplatform_native.py to validate command parsing, dispatch, output formatting, and unsupported-command handling.

Testing

  • Ran pytest -q tests/test_globalplatform_native.py and the tests passed.
  • Ran pytest -q tests/test_flows_psbt.py -k satochip_connect_failure to ensure no regression in related flows and it passed.
  • Ran a combined subset pytest -q tests/test_globalplatform_native.py tests/test_flows_psbt.py -k 'globalplatform_native or satochip_connect_failure' and the selected tests passed.

Notes: the native backend requires pyGlobalPlatform/libglobalplatform to be installed on the target system; when it is missing the code raises a clear error message instructing to install pyGlobalPlatform/libglobalplatform.


Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant