Skip to main content

Python Wrapper Library for Microchip Security Products

Project description

Python CryptoAuthLib module

Introduction

This module provides a thin python ctypes layer to evaluate the cryptoauthlib interface to Microchip CryptoAuthentication devices.

Code Examples

Code examples for python are available on github as part of CryptoAuthTools under the python/examples directory

Installation

CryptoAuthLib python module can be installed through Python's pip tool:

    pip install cryptoauthlib

To upgrade your installation when new releases are made:

    pip install -U cryptoauthlib

If you ever need to remove your installation:

    pip uninstall cryptoauthlib

What does python CryptoAuthLib package do?

CryptoAuthLib module gives access to most functions available as part of standard cryptoauthlib (which is written in 'C'). These python functions for the most part are very similar to 'C' functions. The module in short acts as a wrapper over the 'C' cryptoauth library functions.

Microchip cryptoauthlib product page: Link

Supported hardware

Supported devices

The family of devices supported currently are:

Using cryptoauthlib python module

The following is a 'C' code made using cryptoauthlib 'C' library.

#include "cryptoauthlib.h"

void main()
{
    ATCA_STATUS status;
    uint8_t revision[4];
    uint8_t randomnum[32];

    status = atcab_init(cfg_ateccx08a_kitcdc_default);
    if (status != ATCA_SUCCESS)
    {
        printf("Error");
        exit();
    }

    status = atcab_info(revision);
    if (status != ATCA_SUCCESS)
    {
        printf("Error");
        exit();
    }

    status = atcab_random(randomnum);
    if (status != ATCA_SUCCESS)
    {
        printf("Error");
        exit();
    }
}

The same code in python would be:

from cryptoauthlib import *

ATCA_SUCCESS = 0x00
revision = bytearray(4)
randomnum = bytearray(32)

# Locate and load the compiled library
load_cryptoauthlib()

assert ATCA_SUCCESS == atcab_init(cfg_ateccx08a_kithid_default())

assert ATCA_SUCCESS == atcab_info(revision)
print(''.join(['%02X ' % x for x in revision]))

assert ATCA_SUCCESS == atcab_random(randomnum)
print(''.join(['%02X ' % x for x in randomnum]))

In the above python code, "import cryptoauthlib" imports the python module. load_cryptoauthlib() function loads the compiled library. The load_cryptoauthlib() is a function that you will not see in the 'C' library, this is a python specific utility function and is required for python scripts to locate and load the compiled library.

In Summary

Step I: Import the module

from cryptoauthlib import *

Step II: Initilize the module

load_cryptoauthlib()

assert ATCA_SUCCESS == atcab_init(cfg_ateccx08a_kithid_default())

Step III: Use Cryptoauthlib APIs

Call library APIs of your choice

Code portability

Microchip's CryptoAuthentication products can now be evaluated with the power and flexibility of python. Once the evaluation stage is done the python code can be ported to 'C' code.

As seen above the python API maintains a 1 to 1 equivalence to the 'C' API in order to easy the transition between the two.

Cryptoauthlib module API documentation

help() command

All of the python function's documentation can be viewed through python's built in help() function.

For example, to get the documentation of atcab_info() function:

    >>> help(cryptoauthlib.atcab_info)
    Help on function atcab_info in module cryptoauthlib.atcab:

    atcab_info(revision)
    Used to get the device revision number. (DevRev)

    Args:
        revision            4-byte bytearray receiving the revision number
                            from the device. (Expects bytearray)

    Returns:
        Status code

dir() command

The dir command without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of valid attributes for that object. For example dir(cryptoauthlib) will return all the methods available in the cryptoauthlib module.

Code Examples

Code examples for python are available on github as part of CryptoAuthTools under the python/examples directory

Tests

Module tests can be located in the python/tests of the main cryptoauthlib repository. The README.md has details for how to run the tests. The module tests are not comprehensive for the entire functionality of cryptoauthlib but rather are meant to test the python module code only against the library to ensure the interfaces are correct and ctypes structures match the platform.

Release notes

See Release Notes

Project details


Download files

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

Source Distribution

cryptoauthlib-20250530.tar.gz (565.7 kB view details)

Uploaded Source

Built Distributions

cryptoauthlib-20250530-pp311-pypy311_pp73-win_amd64.whl (155.0 kB view details)

Uploaded PyPyWindows x86-64

cryptoauthlib-20250530-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ x86-64

cryptoauthlib-20250530-pp310-pypy310_pp73-win_amd64.whl (155.0 kB view details)

Uploaded PyPyWindows x86-64

cryptoauthlib-20250530-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ x86-64

cryptoauthlib-20250530-pp39-pypy39_pp73-win_amd64.whl (155.0 kB view details)

Uploaded PyPyWindows x86-64

cryptoauthlib-20250530-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ x86-64

cryptoauthlib-20250530-cp313-cp313-win_amd64.whl (155.0 kB view details)

Uploaded CPython 3.13Windows x86-64

cryptoauthlib-20250530-cp313-cp313-win32.whl (134.2 kB view details)

Uploaded CPython 3.13Windows x86

cryptoauthlib-20250530-cp313-cp313-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

cryptoauthlib-20250530-cp313-cp313-macosx_10_13_universal2.whl (430.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

cryptoauthlib-20250530-cp312-cp312-win_amd64.whl (155.0 kB view details)

Uploaded CPython 3.12Windows x86-64

cryptoauthlib-20250530-cp312-cp312-win32.whl (134.2 kB view details)

Uploaded CPython 3.12Windows x86

cryptoauthlib-20250530-cp312-cp312-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

cryptoauthlib-20250530-cp312-cp312-macosx_10_13_universal2.whl (430.3 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

cryptoauthlib-20250530-cp311-cp311-win_amd64.whl (155.0 kB view details)

Uploaded CPython 3.11Windows x86-64

cryptoauthlib-20250530-cp311-cp311-win32.whl (134.2 kB view details)

Uploaded CPython 3.11Windows x86

cryptoauthlib-20250530-cp311-cp311-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

cryptoauthlib-20250530-cp311-cp311-macosx_10_9_universal2.whl (430.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

cryptoauthlib-20250530-cp310-cp310-win_amd64.whl (155.0 kB view details)

Uploaded CPython 3.10Windows x86-64

cryptoauthlib-20250530-cp310-cp310-win32.whl (134.2 kB view details)

Uploaded CPython 3.10Windows x86

cryptoauthlib-20250530-cp310-cp310-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

cryptoauthlib-20250530-cp310-cp310-macosx_10_9_universal2.whl (430.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

cryptoauthlib-20250530-cp39-cp39-win_amd64.whl (155.0 kB view details)

Uploaded CPython 3.9Windows x86-64

cryptoauthlib-20250530-cp39-cp39-win32.whl (134.2 kB view details)

Uploaded CPython 3.9Windows x86

cryptoauthlib-20250530-cp39-cp39-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

cryptoauthlib-20250530-cp39-cp39-macosx_10_9_universal2.whl (430.3 kB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file cryptoauthlib-20250530.tar.gz.

File metadata

  • Download URL: cryptoauthlib-20250530.tar.gz
  • Upload date:
  • Size: 565.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for cryptoauthlib-20250530.tar.gz
Algorithm Hash digest
SHA256 b3765a001fcd7787687f242ac542964ed14b1554fd232e7cec2c07fda054dc6c
MD5 917985c9f7994ca4fb07e493e35ac24b
BLAKE2b-256 59f435896692d8513f6cfb006cb68f0c78cca07c40354dce996d0cabb098d141

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-pp311-pypy311_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-pp311-pypy311_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 13ee1274db5e29f62eb46baedf9fc0ab96fe977d03f922b4965e05f6aa20583d
MD5 ae836b93a2088a6f8e0a1ec0e8f01e4f
BLAKE2b-256 475d61df4c47c08f9904761fc5f4c0eae615395154883e6da69ba311e7d59911

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f3bfedfb299c106689e0565a1ff8906f1df9c70f64c42fa7919863b68e13c198
MD5 f537be4e42fc8f7c15ac090814fe87e0
BLAKE2b-256 5d5fb23dca5b21112351cded41f7d8d8378291234be522dfac3fae06e50ccda1

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-pp310-pypy310_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-pp310-pypy310_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 5500841d2bbb5d7309b26aeb352adf7c40b82544791fbb7e407743799aada488
MD5 8cae79060a9fb5f7d22d6515b665c5eb
BLAKE2b-256 ed930f9ae7a718a226775b9d43d1719659c38172c085b6041356a2cc9b649e2a

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2fe29f1bbff2fcdc30dd8c49d1763bfdea431bca80d26c6e777493939f3d1ec4
MD5 10796aaa24b761837a27f714d4acb2c0
BLAKE2b-256 d60b088dbaf10fa09b74c0fa0896cdfeb7003e56200e9f9a4cbd835c865a2782

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-pp39-pypy39_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-pp39-pypy39_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 948453e4386d4d75c830718a747f9ed0123436e51034029a4d735bd1965fed12
MD5 5215e49c61f992f34efa909deafd35fb
BLAKE2b-256 03fb6a1d0db355a9d870e74121369c1dd00320f6e35c818b9cb3f6e816078b0f

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ad9448f3a764834465639cebbab6b2a5f7cf4202ad63611ea02bcbdb7ebc0cdb
MD5 59b9f8046354f7d2c7afcc91dfc679c1
BLAKE2b-256 57d086de73f3e1ea59f1e6e33b22281bc62a14aa122edcf28f6f91798f589819

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3e3375c5870db0bb6356c356fe3cc0f1de56c7ac275d296df33a110a1e09193b
MD5 1392b48d55fe98b808d15b5c05be3d68
BLAKE2b-256 fd47c1a4718b924fdb0e0f4d4e8870043b20b4d56ffcbbbd37323e288ad08097

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp313-cp313-win32.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 e6d0e9d28cb601f098bb2cd87e727ea690776c4e070cd47d2ba03fe9aab9912a
MD5 10aa34da09e4acc4cbdfec513e4cde9f
BLAKE2b-256 e47eaddf0efc968cf06ff273e9a685d9fef0129110cd61b0cea3bd178ad8dd1c

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 90871b3101014d59056d6d4924f9316a502d40346081b6c9ecea6f6d8c424cb2
MD5 1e1be96bb72dfc968668a3fdfbf0ce65
BLAKE2b-256 b74d9b12ab82312034b83138deb9c24a2f5b3a40a3b027eb52b1f9f0ac1d3090

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 4bea1adca3147723b718dce8d33f67c0273722bdcaf890fd0839f1c32e43e61c
MD5 bc08d9adf1cab51e0ecbe7b592c4d802
BLAKE2b-256 d2f4b2adddba9abe8883382f7a235cea2806b7745e8cb4aa5c83e0dc5fe8016c

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6a1096088ecaba3c596579e1644ac3968002f0c668fc8587cb4b25458ddeb09b
MD5 fbfb83d6f6c449268940d5390a0a9f3c
BLAKE2b-256 68df6b58e16194a1875085bcb88461bacb6221d7b0f1223acba0c51b821696d1

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp312-cp312-win32.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 2e49be4035590379264a12fb1f3a7a09200e86cdad1d2e676cb567a0ccbf36ec
MD5 3189204dd311738dd21c8b883f17de1d
BLAKE2b-256 cecb2efda29d06b80ada052d65abd3083defd4c6623b2f18a2217face4cda787

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 04918cb21b88b9a9089d88ee2287670e00940aa5e6876809cf332b9105455914
MD5 9757c9e13722d3120034d0857e57c421
BLAKE2b-256 b537899683c4e15dfb3a41dea4e8f62f88e12aa59f6280db643015f7834b4692

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 fe30313e0fe4c2d494a27d6080023b9ed3488bd61546b81002f8df61aec1e638
MD5 6071cdbee965892ac405a2db1893b447
BLAKE2b-256 afaff5a52ecf6067c1c7aeb763ab82a6b91ab97cab5b21353ca112bbf6272c26

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1836c16dfe1a0a0a97b3642f26428738e556b3656a864eff1766c0ed45b9cd88
MD5 5038878d8c99c39f32c23f08f16a2050
BLAKE2b-256 8ec625f5d326bdb21c7fd4a4a34b7448cf6e886002385a9280b52692cdf1ae0d

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 7036c24df7deee72a31723ecb8803fe4cb5483a7d73b6ef5f9a70e974a888b95
MD5 e0a4a44cdea325b66763564d81a99d80
BLAKE2b-256 267e4c5c342265b257663f191f1cc62822fe38cf0e060a97cadbd775348d9cd8

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b6646176591f1cf1c28225616e3bb89c78e16788697aa8966cd64ee4cda6370
MD5 02c816b723fc028f1bdf7dc925481f8a
BLAKE2b-256 678336e78dcc093e64f0e470e230b95da920c5f1116e454cad10dde58627eadb

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 e866c1da762cf9add3305816637db73e9e3c743a7c8ec5de21f1bf9727eb764b
MD5 6c118ae4c86bc533d5a8b10c62fc8885
BLAKE2b-256 022e61acabc68bc7263f1b8532f662ebe6cf43c622305b412e75f13c33a14c5d

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e6b57303d26fd51bb4b3bbf8c918305a4bf3becdd5e04f0f5bcbb8ccdeb27ab9
MD5 a281d525a4327aca2174b74a7d4f80a1
BLAKE2b-256 bc0ef969f0cf47d652e12ca77ea77f24de90124c6622daef208c960f60884318

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 936f354037443d07e812259d74c341adb965a5956cf5babd060f50e8d144678d
MD5 c09345eea1a01ba8ac81dbe51e49d0f8
BLAKE2b-256 218d5995f7fe342d687f16ae116a4a39babc92024f89bd26016cc2f37b46542c

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 02ced4f1db5ae5936f097abace51471c09c214535b4be3208604b7a86bc95956
MD5 43395fd144f7514cc5e1a0d4b3328b31
BLAKE2b-256 90c8092a99090fbd91249faf16afc91a52848e1afc13be62d2114e338b7c29a5

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ce9bb7301dee3c00d6f4d07e328d455615e23aef57c403a55e57bd6a33507390
MD5 332aa44a6c322c0a6f749a102dcea701
BLAKE2b-256 6f54667a09ba2bce50d6039bf204181956638d52164e8f3539dc26dfd4de4bf7

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b5d3d1d23296e7426233d4233cc74b9e24b1005bba32ae5c3c2cce6f54a95048
MD5 5733e5319e5ae7336a0cfa914ba9096c
BLAKE2b-256 192f1d5a49fad42e4b06d1c4a7fb530cb83b8c24ea4282e8352eb19c22275f2f

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp39-cp39-win32.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 d5e2df5c8fd94991fbd8db47fe930ec74787fcf382668c34f1c5167806d53e5c
MD5 488a389d3265559ee0354c96911265f7
BLAKE2b-256 d7527a7cc431e6bebd1546be26268f9bc7c2f397f9c14071d13311c00bd55658

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f3a2eb13e59be6e96b30ee9f9233aee41a7d90d2269aae89fcdb8ef70bdd5149
MD5 8f56f40bb8cd70982463a0af2001aaea
BLAKE2b-256 dada1b428044b22783888ee997266d5d4cc0c715fffb598f14b4f99dad1e1124

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250530-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250530-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 814a0b6736391833da86d227a08d4bf3a273f78a298bbb4e8f065cc205ff40d3
MD5 0927a1083339e406599c7bae8821df80
BLAKE2b-256 5df70dc94d0271515fd2465c481ce6e29cfff969be8d42556d30f3bebc33a6d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page