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-20250916.tar.gz (568.4 kB view details)

Uploaded Source

Built Distributions

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

cryptoauthlib-20250916-pp311-pypy311_pp73-win_amd64.whl (155.5 kB view details)

Uploaded PyPyWindows x86-64

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

Uploaded PyPymanylinux: glibc 2.28+ x86-64

cryptoauthlib-20250916-pp310-pypy310_pp73-win_amd64.whl (155.5 kB view details)

Uploaded PyPyWindows x86-64

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

Uploaded PyPymanylinux: glibc 2.28+ x86-64

cryptoauthlib-20250916-pp39-pypy39_pp73-win_amd64.whl (155.5 kB view details)

Uploaded PyPyWindows x86-64

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

Uploaded PyPymanylinux: glibc 2.28+ x86-64

cryptoauthlib-20250916-cp313-cp313-win_amd64.whl (155.5 kB view details)

Uploaded CPython 3.13Windows x86-64

cryptoauthlib-20250916-cp313-cp313-win32.whl (134.5 kB view details)

Uploaded CPython 3.13Windows x86

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

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

cryptoauthlib-20250916-cp313-cp313-macosx_10_13_universal2.whl (423.2 kB view details)

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

cryptoauthlib-20250916-cp312-cp312-win_amd64.whl (155.5 kB view details)

Uploaded CPython 3.12Windows x86-64

cryptoauthlib-20250916-cp312-cp312-win32.whl (134.5 kB view details)

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

cryptoauthlib-20250916-cp312-cp312-macosx_10_13_universal2.whl (423.2 kB view details)

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

cryptoauthlib-20250916-cp311-cp311-win_amd64.whl (155.5 kB view details)

Uploaded CPython 3.11Windows x86-64

cryptoauthlib-20250916-cp311-cp311-win32.whl (134.5 kB view details)

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

cryptoauthlib-20250916-cp311-cp311-macosx_10_9_universal2.whl (423.2 kB view details)

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

cryptoauthlib-20250916-cp310-cp310-win_amd64.whl (155.5 kB view details)

Uploaded CPython 3.10Windows x86-64

cryptoauthlib-20250916-cp310-cp310-win32.whl (134.5 kB view details)

Uploaded CPython 3.10Windows x86

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

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

cryptoauthlib-20250916-cp310-cp310-macosx_10_9_universal2.whl (423.2 kB view details)

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

cryptoauthlib-20250916-cp39-cp39-win_amd64.whl (155.5 kB view details)

Uploaded CPython 3.9Windows x86-64

cryptoauthlib-20250916-cp39-cp39-win32.whl (134.5 kB view details)

Uploaded CPython 3.9Windows x86

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

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

cryptoauthlib-20250916-cp39-cp39-macosx_10_9_universal2.whl (423.2 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for cryptoauthlib-20250916.tar.gz
Algorithm Hash digest
SHA256 c73272d66f5e2fff7835b8872e92b41d8d9f4211ebfd38db854781922efc91ad
MD5 50b8c203daa85a2981c9a220a3f9252f
BLAKE2b-256 d08df881e00b6078bb150cd738b435b8bdc985965470e0119c314b67fa2c26ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-pp311-pypy311_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 b7ef77f93fce09232dc20a4ffeb5b62f7509269bca697faada8399e4cba7cb3e
MD5 85b27254c80560c28b7b3127e660a2b8
BLAKE2b-256 dd528573cf716a5c804000af0ac705ceb06792627d379cf35d6a7b97f91e82c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f980b3afa79cd89c240195462f5629f617ef3bb39420d5d6b343bc006079b2ae
MD5 53f1b15686227e9dfd8144ca455e31ad
BLAKE2b-256 684aa84175c035544576fea12c805afd672b41ab5db3b47eb2f2dfd09ac7d5b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-pp310-pypy310_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 fd9495bdb2bd7f59a3556b246437d4bce7526a41650bb3a0739a887f4faf2add
MD5 7067b038e98864865726e138048bce68
BLAKE2b-256 ec017a8a84717bb63fb5bffed0c226f7f023dff50e6fec42d60f6ccd72ee2225

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1797922a626dc6be8125f6ca338d821f676a73f67748d65a7cd28e4378bb664c
MD5 11c86b51519fa5e557c1f7b759a786e2
BLAKE2b-256 4392e4b03890b9e906376597cb38ea8ca54a1bef2f7cd17adb7e90a4157a51fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-pp39-pypy39_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 6ccd8d786bd1dd5df5619abac0ed53198fd1a91289ebe9dded7b3eb3efc9d84c
MD5 5b05d6e8c08c02c39ab7a6505a17141b
BLAKE2b-256 138b5c16b1828b72a59d164d3ace0afcdc24f7f3325e5a9d076279df8b2ecbf4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 06970fbb6894ec8c21c961271dc75320568e7efb43f439bbd4ea1ea1507e4ddd
MD5 e3c4c046ecd80e8c37c4f31837a96bb5
BLAKE2b-256 de2d61a8754eea737189eb6b713981b4ab0fd37351dd1ef7773105d31793c3bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9ea44c5c8b21ac6084b6aa5f2fcfd620e5c8cba00ac6ef1e1f62c098968dd227
MD5 1940b9abf05b3585d68fc138ca7df4b8
BLAKE2b-256 3848ae439ce6497793067772690c50bcd2caa302f464ca8f75e1459b5d8cc818

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 514547ade1ed9ae1ccad97e5c23027c7a9f108181ac7ead6ac701fcff8cc621f
MD5 fb112779e63229d76233bd6de2329370
BLAKE2b-256 9053f07cb1f4660d5b09b5751e42f426c247109e13b663605dc9973bebb9d2a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2497217080cceab75632eb3d3f25a7c15658ab28e218c6ff73674ad2a236a829
MD5 27f64ffc1834b8925da4298adfc94319
BLAKE2b-256 cb65c9f0451d83a60e7082e1152ec391786c7ebc47240e8b93083d5c4f9f20ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 a6c81dc2e038ebc12ab7b415d397f617d97dee6b5f74a8094bb25144d248259d
MD5 718aefb075e24aa98c345b16bf29ac73
BLAKE2b-256 238b2831972427a0a151f21ce930aed1ac6a3605509f30d821b9dc31e477826b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b4103075b125c521b176b31243260613576510af2ba65c75f9d63250f3e53905
MD5 ae0d061a1304663f0252d195beefa964
BLAKE2b-256 253c4ff39fe8d2f3464da59a180eca3f186ac9a84f423ec13b8ea12a1f3aeae8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 046d9379d961e72fd876100f029a6266c242958cdf086694004b4a744ef8c226
MD5 86b0e19d133196fb90aecf5003080d53
BLAKE2b-256 4d10268b6ba06182613685edd10614dc5a8820ca1eb1708d8e38c1ce7325220b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 37818386b65998239c781a86338299b40e6b164cb2356e803602fc71dfb0291b
MD5 6663d90b875c63bd289027dd1ad468bd
BLAKE2b-256 97abd921a807ec194e2f89d060c6e4aecbf7b54b0df301ac59a3c9275e50c85b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 b43716c1d9598513a2653f4b4a7cd68dc8d5eda1a4271b91f0bb08d75d922608
MD5 e83dc554618e770367b743171c0cfeae
BLAKE2b-256 ac4a45772a881e11d03d9b28d1173a1a3651e777be0714b9d95a35cc8c4ce885

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9cfd616aba99db00e997ff8a35c6dd79f59ecbb911d84353c6824fc6640bb2f0
MD5 94717bc7a6f44b1665e8b289875065bc
BLAKE2b-256 dc75d8b3fb75f328da165fa6b03285ab5b415d2bb36c90920db60726940246f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 a6d673e77877fcd552883640c392331976e6ac6eaecfe8457f7866c3b2c90126
MD5 4b3c7eb781fa52cd9953d68acaa2933f
BLAKE2b-256 e5a2cd61a57e5eb3acf9f8f79113798c3434d66d08a391124242eddd8925a37c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 73b1427bc5e492e153684ccf4fb234661b37fd96cd000df48e78824c73502383
MD5 f5c8c13a7ff4ff9e21e5d4db1630a0bd
BLAKE2b-256 aff55425016f3aa58d3d9b2489776405e487c62b2afb554f6241161f5166dd5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 d427196196eff36486c2b24f990ac5902f44c6ce748b257f9b02f9578c623b2d
MD5 2658ca99456c703d9179b7629895689e
BLAKE2b-256 b652305ebb1a4e6cfbbb3ff7caf8bf0984de93637b8944c06bb478ec10588ec4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1de73ecf02405bdb201b74f6e282c6f89cd9116e58ed2719cfc92a9d055c8a8d
MD5 f648426ba587f62c5e4468757e4adb40
BLAKE2b-256 39267878e77056296d086dc7336c664206e0a4dce9ab4e13b92a08c9311578e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 b171b160cee56b3a8616cc195185d2540a35712dcd08bab3ae386be3b8cc8b02
MD5 3c38489b1ad8fa3d3c0fb4ea1ccd5eb7
BLAKE2b-256 a033a7e6d9e6695447ca880248dfc077af02f6bc8510dbde4f58ee2ae61e93ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 938e742c67771c6c3a3367b32583da3020201a5fe0ab6d4645b655653b80af2e
MD5 98305655156e1ad73d94f87236d27788
BLAKE2b-256 7e7bacc009d1d4f94a0cbc90a75f55e7cd6a6bfad98d395c204333ab48f1970b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3b762f1b0530a065289981e1854d0165747b82af68e909a8f3dface59d23b34a
MD5 a2c4883f021ad8ced83d9d11d9a9e917
BLAKE2b-256 6cd66d510c37b5d71a76eaf93b3acf955098bdb64e43c44fcf364ed9c256f871

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3df18974b23384a9ad1a34dbfa574ec2ecbc37cb8f5b402881917dbf5e11135d
MD5 abe71ea00572ecb1fcf06f891b09d5ce
BLAKE2b-256 233701deec121401ecc31b404896258cfead8a4e63de69a31f35a47f920b3c0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 65d7b4467bd368abd35480820c9e7229a6d4cdfeb55e6af3bc54bccc38ae06ed
MD5 9e4c3750bedaa4ed939905c7e25ecb4f
BLAKE2b-256 64b5ce498a30b76411a2cb4c413e8c16848f0d03dea752c75aca92bab052a098

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4a760eecdc7004f7bca1765d601ea6b6473cdbc2e3f872777a3ada3a2fb8ccc7
MD5 65c6db18d139da1724c9942bd3c71c42
BLAKE2b-256 ba5af4b32361a3f29418be39894533be4f118ba69ff83ef6bafa144fa6310e6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250916-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 f05a89ec7c9d4e2fd375a3976b6e59da67b145f7c8a5d9689b1e03f5399e7a6c
MD5 600de4ddc2ba7c3674e63aafdd3eca4b
BLAKE2b-256 4fe9975aaa78ea0883c8fc4c75e2814f2826106b15d0a79f9ce739c32a6fef92

See more details on using hashes here.

Supported by

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