Skip to main content

optigatrust

A ctypes based Python wrapper to work with the OPTIGA(TM) Trust security solutions.

PyPI

Features

Function Module
Elliptic Curves Cryptograpy optigatrust.pk.ecc
ECDSA optigatrust.pk.ecdsa
Certificate Signing Request optigatrust.x509.csr
Certificate handling optigatrust.x509.cert
Random Number Generation optigatrust.rand
Write/Read General Purpose Data optigatrust.util.io

Dependencies

Required Hardware

  • OPTIGA(TM) Trust Personalisation Board, or
  • any FTDI USB-HID/I2C Converter board
  • (planned) Embedded Linux with open I2C lines; e.g. RPi3

Installation

$ pip install optigatrust

License

optigatrust is licensed under the terms of the MIT license. See the LICENSE file for the exact license text.

Documentation

The documentation for optigatrust is composed of tutorials on basic usage and links to the source for the various pre-defined type classes.

Examples

from optigatrust.util.types import *
from optigatrust.rand import *
from optigatrust.pk import *
from optigatrust.x509 import *
import base64

print("Rand size 8 bytes: {0}\n".format(list(get_random_bytes(8))))
print("Rand size 16 bytes: {0}\n".format(list(get_random_bytes(16))))
print("Rand size 255 bytes: {0}\n".format(list(get_random_bytes(255))))

ecc_key = ecc.generate_keypair()
print("Generate NIST-P256 Keypair: {0}\n".format(list(ecc_key.pkey)))

ecdsa_signature = ecdsa.sign(ecc_key, b'Hello World')
print("Generate ECDSA Signature using the keypair: {0}\n".format(list(ecdsa_signature.signature)))

csr_key = ecc.generate_keypair(curve='secp256r1', keyid=KeyId.USER_PRIVKEY_3)
print("Generate NIST-P256 Keypair for a new certificate: {0}\n".format(list(csr_key.pkey)))

builder = csr.Builder(
	{
		'country_name': 'DE',
		'state_or_province_name': 'Bayern',
		'organization_name': 'Infineon Technologies AG',
		'common_name': 'OPTIGA(TM) Trust IoT',
	},
	csr_key
)

request = builder.build(csr_key)
csr = base64.b64encode(request.dump())
print("A new CSR {0}\n".format(csr))

Testing

Tests are written using pytest and oscrypto and require these packages to be installed:

$ pip3 install pytest oscrypto
$ git clone --recurse-submodules https://github.com/Infineon/python-optiga-trust
...
$ cd python-optiga-trust
$ cd tests
$ pytest

To run only some tests, pass a regular expression as a parameter to tests.

$ pytest test_rand.py

Development

Existing releases can be found at https://pypi.org/project/optigatrust/.

Metadata

Release files for optigatrust 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for optigatrust 0.4.3
File Size Uploaded Provenance Actions
optigatrust-0.4.3.tar.gz 17.1 kB Without provenance Details for optigatrust-0.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for optigatrust 0.4.3
File Interpreter ABI Platform Actions
optigatrust-0.4.3-py3-none-any.whl Python 3 none any Details for optigatrust-0.4.3-py3-none-any.whl

Total release size: 205.3 kB

Release files / optigatrust-0.4.3.tar.gz

Download URL optigatrust-0.4.3.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ef44ea738602ce80093b7f03349a1074879bc0cde64ed1c7dd75a5e429b98591
BLAKE2b-256 checksum
How to use checksums
ce6cf9cb85fc63ff40cd0d66e5c833005aee3bce80e134dfb36b9330d31fe7eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / optigatrust-0.4.3-py3-none-any.whl

Download URL optigatrust-0.4.3-py3-none-any.whl
Size 188.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef7f53a314aed864c39cf246fc2c8e78a49a4e0d0bcefcc435b249f88e7a1e53
BLAKE2b-256 checksum
How to use checksums
52dad9997c9ff7a72fbefb88ff0a9dd38acb125e25b3e15d241a4f42e705b5e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Security for optigatrust 0.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page