Skip to main content

Python Wrapper Library for Microchip Security Products

Reason this release was yanked:

Missing packges for different platforms

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

cryptoauthlib-20250213-pp310-pypy310_pp73-win_amd64.whl (155.1 kB view details)

Uploaded PyPyWindows x86-64

cryptoauthlib-20250213-pp39-pypy39_pp73-win_amd64.whl (155.1 kB view details)

Uploaded PyPyWindows x86-64

cryptoauthlib-20250213-pp38-pypy38_pp73-win_amd64.whl (155.1 kB view details)

Uploaded PyPyWindows x86-64

cryptoauthlib-20250213-cp313-cp313-win_amd64.whl (155.1 kB view details)

Uploaded CPython 3.13Windows x86-64

cryptoauthlib-20250213-cp313-cp313-win32.whl (134.7 kB view details)

Uploaded CPython 3.13Windows x86

cryptoauthlib-20250213-cp312-cp312-win_amd64.whl (155.1 kB view details)

Uploaded CPython 3.12Windows x86-64

cryptoauthlib-20250213-cp312-cp312-win32.whl (134.7 kB view details)

Uploaded CPython 3.12Windows x86

cryptoauthlib-20250213-cp311-cp311-win_amd64.whl (155.1 kB view details)

Uploaded CPython 3.11Windows x86-64

cryptoauthlib-20250213-cp311-cp311-win32.whl (134.7 kB view details)

Uploaded CPython 3.11Windows x86

cryptoauthlib-20250213-cp310-cp310-win_amd64.whl (155.1 kB view details)

Uploaded CPython 3.10Windows x86-64

cryptoauthlib-20250213-cp310-cp310-win32.whl (134.7 kB view details)

Uploaded CPython 3.10Windows x86

cryptoauthlib-20250213-cp39-cp39-win_amd64.whl (155.1 kB view details)

Uploaded CPython 3.9Windows x86-64

cryptoauthlib-20250213-cp39-cp39-win32.whl (134.7 kB view details)

Uploaded CPython 3.9Windows x86

cryptoauthlib-20250213-cp38-cp38-win_amd64.whl (155.0 kB view details)

Uploaded CPython 3.8Windows x86-64

cryptoauthlib-20250213-cp38-cp38-win32.whl (134.6 kB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-pp310-pypy310_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 2a3f89182ba5d57d3d9b0f172d6dd762b589d017b2685a525a3922992002ddab
MD5 2ddf770c16e260af97d9a7d012a611c6
BLAKE2b-256 d385aa8b0606b4d3a839fe9acbfd95a36bf45659a8d8df7abe00606cbe6c5eec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-pp39-pypy39_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 0b59dfc08bab259b7e084dc51eb030d7300b04d801fece4b556b64356277d6d3
MD5 d83157288a5ba3aa25d3e057e89abed6
BLAKE2b-256 e72dc8638c43ce74dfc15ff46a926354dec83560b2da07352c8d41f6a5f12257

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250213-pp38-pypy38_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250213-pp38-pypy38_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 34d4b0ba2eb61d07dc21d21f84f6e37c3186293d9fcaa0a810656a1838a95072
MD5 8f451a2fd2f58d07183ad5bdbe046bb8
BLAKE2b-256 c95a7db0820851ec2e1ce64f9a66551abaa61ff924c4691a72f32297a953ef06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e46fc218e66ed1ceeee3d1050f16c61c88f2a8e81a6bf3b30a21fb51b31206b2
MD5 f66fb02533d84d0ebe4b61ea815b741e
BLAKE2b-256 30f78295d80e9db8ec5c163c2adb87ebd031354ca878baf23f289c239df4b565

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 b3d8d6b3ee7c2b2135712028dfc4a2a16654eb025b6660c6c700885af2d9c3b4
MD5 127c87e8eccecc5eebdf4282c164ced3
BLAKE2b-256 4527c12de1731efbc609825337e8a976af600fb1bfd8b10ca945f89ec0efc302

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1f2280df132db4b0f790c3dd30788a1b3caebf69241737bf261ef84f0de1ec51
MD5 5c68bc3185d82b1d7735d615296425c0
BLAKE2b-256 c193f060682a798be83985499a5cbd04c4c6b2be52a21f53360b10979ab82558

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 5a7b3b3ceb1ae729e5a226bf003b2c895514a296edc67bf09d67302dbd9bbda0
MD5 51f1f2f0ff2aa315415f8a473727a170
BLAKE2b-256 c43b52160d36f2065d81aff04cece1f2cec7ea2d92a16f094ec596badfaa2577

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f94bd01a87bee453dfa447d29a073c4b5e919331e9e4bbde40f88601fb3a190b
MD5 4e230908b42da74c7188c7a6dc88563d
BLAKE2b-256 8f6b01d18a9c69b7e817ea22521326c532ae7b99f7e0bbcc72e147261e80c6dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 532397c1afef2bc2950bcca6e4d019c04d39007b93d646d7cb08446412ad4d1e
MD5 addeb119fd595e2aef7a3731973a092d
BLAKE2b-256 6191ff69599733fb1de8633656666772287f59c94501cc972fdd0ec04a4d164c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 187b528c53ecfd3343fb28b280b76fe135ffd244670c3f6f758e8bb0ec5f90ca
MD5 b8b267400ad9d9b4195896c4afa0a5fb
BLAKE2b-256 552a7c12f8ff97b3f9b77ac9ca1b87f5cd6c90c4ad7c5de04270796eec056fca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 4a8755b1be64e0b11d6397566ae26a3733a0e13d0b56bf57755bf0cd7989cb9e
MD5 96e369cdab046e31e1232c7836175f65
BLAKE2b-256 78392e3b3b376a145f2aef8c3dbc7180fbd19520c6018315cb86755f9f912785

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 68d34e76afd8539f0084d8b808cac2e6186f200b02fc185520bbc9d8dc220f43
MD5 fbca7fed7d48b49e82d7a8d8ccb6150c
BLAKE2b-256 06d06c66a5ab9ba99d349550a7e3303e6afca2fc6e1afbe9905fc5ca4e52de4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 414f011e2523dedd9c31d79aac18c079069d67d6f8fa38ab27b4f856fafdfc80
MD5 b16c1002a2849e704b190083275fd54a
BLAKE2b-256 87ccebf41b7c3771f4f42dddfef214c42526eda6d872843df3e104230b0b6540

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250213-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 61c878eff29df16b9a61b5f95cd3e2beceffd5f1c522eb27725aa1aa6a878b05
MD5 209bcafa050368d17bb87af11c432c81
BLAKE2b-256 aa5c5fa610ea38927ae891ddc3d64401fa63fcff8abf2c7e6f6e6187138b0257

See more details on using hashes here.

File details

Details for the file cryptoauthlib-20250213-cp38-cp38-win32.whl.

File metadata

File hashes

Hashes for cryptoauthlib-20250213-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 6facbc538e86d3eef35fa759ab543f3ffd71f2c1e823386be5fb3190dbe0f601
MD5 3f3099b25b7e5c2ab0340b22ded9e2fa
BLAKE2b-256 6aa5f966b68456b0c7751c12c89e6abaa6f4d27ca9264ff6ebaf87d7f685922a

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