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.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',
	},
	key_1
)

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 require this package to be installed:

$ 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/.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

optigatrust-0.3.6.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

optigatrust-0.3.6-py3-none-any.whl (244.2 kB view details)

Uploaded Python 3

File details

Details for the file optigatrust-0.3.6.tar.gz.

File metadata

  • Download URL: optigatrust-0.3.6.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for optigatrust-0.3.6.tar.gz
Algorithm Hash digest
SHA256 75098fffa8ff15a9465548f79391a598787f044a28cb54c59d7f1535177c83f8
MD5 37c7c07aad99457128644dc00a269c44
BLAKE2b-256 8d15d45806e2184232e55868132354d3fe9fa43d8cbbcb48b206a6197212ed2a

See more details on using hashes here.

File details

Details for the file optigatrust-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: optigatrust-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 244.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for optigatrust-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fc66d4774b9ca626e0cd5fbe7903c8a80306486520a76382587d107aa022aee7
MD5 5e679fcae7a2be02eff6e779e2d060d7
BLAKE2b-256 a1f27f5f47a9f07f7ab287d3e17e56cdc42931ad1ab9ac2caca594eb17fe17b8

See more details on using hashes here.

Release history Release notifications | RSS feed

1.5.1

2 files

1.5.0

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.8

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.3.4

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.7

2 files

1.2.6

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

1.0.7

2 files

1.0.6

1 file

1.0.5

1 file

1.0.4

2 files

1.0.3

2 files

0.6.11

2 files

0.6.10

2 files

0.6.9

2 files

0.6.8

2 files

0.6.7

2 files

0.6.6

2 files

0.6.5

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.4.7

2 files

0.4.6

1 file

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.3.17

2 files

0.3.15

2 files

0.3.12

2 files

0.3.11

2 files

0.3.8

2 files

0.3.7

2 files

This release

0.3.6 This release

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

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