Infineon OPTIGA™ Trust M Host Library for Python
March 31, 2025 · View on GitHub
Infineon OPTIGA™ Trust M Host Library for Python
A ctypes based Python wrapper for the OPTIGA™ Trust M Host Library for C.
Features
This Python module is a wrapper for the OPTIGA™ Trust M Host Library for C and allows the communication with OPTIGA™ Trust M devices.
Please see the OPTIGA™ Trust M overview repository for more information on our OPTIGA™ Trust M product family.
Recommended hardware
The following two hardware setups are recommended for use with this project.
| Interface | Host Hardware | Adapter | Sample |
|---|---|---|---|
| I²C | Raspberry Pi | Pi 4 Click Shield for mikroBUS™ | OPTIGA™ Trust M Shield |
| UART | Linux or Windows host | PSOC™ 62S2 Wi-Fi BT Pioneer Kit + OPTIGA™ Trust Adapter | OPTIGA™ Trust M Shield |
Installation from pip
To install this Python module from pip, run the following command
$ python -m pip install optigatrust
libusb: Allow access to USB device (USB-to-UART-interface)
If you want to use the optigatrust Python package with libusb and a USB-to-UART-interface from user space, the access has to be permitted with a udev rule.
Manual installation of the udev rule
When using the OPTIGA™ Trust M Perso2Go board, add the predefined udev rule as follows (root permission needed).
$ sudo cp ./src/optigatrust/rules/90-optigatrust.rules /etc/udev/rules.d/
Automatic installation of the udev rule (root permission needed)
Alternatively, you can also run the installation with root permissions which will install the udev rule for the OPTIGA™ Trust M Perso2Go board automatically.
$ sudo python -m pip install optigatrust
Building from sources
Building the OPTIGA™ Trust Host Library for C as library
Please follow the steps in extras/optiga-trust-m/README.md for building the OPTIGA™ Trust Host Library for C as library.
Installing the optigatrust Python module from source
Please follow the steps in INSTALL.md for installing the optigatrust Python module from source.
Project structure
python-optiga-trust
├── docs
├── examples
├── extras
│ └── optiga-trust-m
├── src
│ └── optigatrust
└── tests
| Folder | Content |
|---|---|
| docs | GitHub.io documentation |
| examples | Example Python scripts |
| extras/optiga-trust-m | OPTIGA™ Trust Host Library for C as submodule |
| src/optigatrust | Python module optigatrust |
| tests | Tests for the Python module optigatrust |
Licensing
Please see our LICENSE for copyright and license information.
This project follows the REUSE approach, so copyright and licensing information is available for every file (including third party components) either in the file header, an individual *.license file or a REUSE.toml file. All licenses can be found in the LICENSES folder.