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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for cryptoauthlib-20241015-pp310-pypy310_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6576a67f1eeacee8dc9213f6096d7a87fecf0ed31cbaa8d7a5408677542b6ed |
|
MD5 | 7cf1631700e96ab5ca502680d4d44b78 |
|
BLAKE2b-256 | 7e5b6eb42f1fddefb26300411dc556bcfbaeca3a354f1c3bf1f9ed29732b574f |
Hashes for cryptoauthlib-20241015-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7b056ddebf01d8c4469826a6dd62a77cc28e066e4a2f2ec4abe0913a12f2ef1 |
|
MD5 | 2d21cf87443c5fdad3d39da2eeb84181 |
|
BLAKE2b-256 | 502f151bd46f47c4261e70f36365a34a0f1cf708309b3271d07e9d33d045d37b |
Hashes for cryptoauthlib-20241015-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 503cefc7078c3fd3ab2ce12fdb434c46acdc2eee8ebf4c0f1759277bfcf78dea |
|
MD5 | 31995e35c8c45d80780bfaba0aed3825 |
|
BLAKE2b-256 | e196a50301a095a54e1e6febb012b9a2c81c9c29b603918aaeb59515c5e71240 |
Hashes for cryptoauthlib-20241015-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f8338afe9a3a44ce0bf0af70fae8c883052af5254c0db64dc14f57c904a40af |
|
MD5 | 1c77e214e3e96a51a4b49638c7104c3e |
|
BLAKE2b-256 | c50afe9da056d4ab6b9ff5393974ce1dbb19671aaea16d66d3c6b75250f89e64 |
Hashes for cryptoauthlib-20241015-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6a35e8f0feacb9bde92fb7a9fe1ad70bf5262b661a8a0544dcc9d75ac9221c8 |
|
MD5 | d6137dc821e752e80090b2cc0d7dcee4 |
|
BLAKE2b-256 | 518dab17be2e8b4ea130f1b24febbf5aca691daae4244727b54010e3fc9a48ed |
Hashes for cryptoauthlib-20241015-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed9eb2d66fce6b75888c19a307ff97d5219a141228a1a1b4e964fc6a77ed5822 |
|
MD5 | 53c5ec66df56b944bce2127300131113 |
|
BLAKE2b-256 | 111fa8a7445f87bbd08531d54d4c46ea002f652daf3b947082d4e68e4bac0d70 |
Hashes for cryptoauthlib-20241015-cp313-cp313-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c862e622a1ddb5a843b10e05b1f0cfa5201fe85f470eefd613b4496b13828bd |
|
MD5 | f37d8635398f55766d6789f408e29fb9 |
|
BLAKE2b-256 | e3da3ddc381b1d7e4c3e7406dfb9a2b46dbb47263c0eaae962b82dd11fc6a096 |
Hashes for cryptoauthlib-20241015-cp313-cp313-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aab8b04bddea47453fc8104357a05b94c8b3189e5e481d647a227cd570eb4442 |
|
MD5 | 9646a1847d0a95c29c296d2337484e1a |
|
BLAKE2b-256 | 4e644a16b0f145a6af699a6a4ce2ae839df6f20a123609a7533498669ad4aa63 |
Hashes for cryptoauthlib-20241015-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ac7306f4d91d3e1ee0ab93968b8651fbd27c306916b52a9b062396b1123bdaf |
|
MD5 | f1679a4a2785dd4ff4b81fcf983babb4 |
|
BLAKE2b-256 | f80433a2d71b5fb524a315fe9e43933c57a57e45302aa340a54008785e321a4e |
Hashes for cryptoauthlib-20241015-cp313-cp313-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1439e06bdd59f59c51e03fa4d8defbf7445c9cd1302559649d2a8c2ee640fe39 |
|
MD5 | 407d495515c4bf82c5b91158ee53dd0f |
|
BLAKE2b-256 | ed8b8381e9849c3bf073f982548ea28a442ca79d70303f2ff75869131ec29223 |
Hashes for cryptoauthlib-20241015-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9817a524092fc25969f4cd0f491ff6eb9fa1aa5c3af2934afb2545aec819ced2 |
|
MD5 | 511492d5f28d188490498c2705f3e27f |
|
BLAKE2b-256 | a1a7751418c46a9b119f755d9f34dbd21417e1ca9eda68e5f7e0ad514d375c63 |
Hashes for cryptoauthlib-20241015-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 114b97bc55ff059ac296f7f0093e017b648b03880f1ddaa57832e3ea7d61e3fc |
|
MD5 | 69a04a3d78f739f44855f2b097a37453 |
|
BLAKE2b-256 | 949f8e1973bc17b3104e369b6e28227a959ed7ecc30a69f6cd1caf8cf942ed9b |
Hashes for cryptoauthlib-20241015-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a72bbed5b22a296cec92ebf98aaae514ec615225c31c3a29e1027070a2d2c3a |
|
MD5 | 80986924e3391dbdfa2d6e3b3e4ef7e7 |
|
BLAKE2b-256 | eca239bd1973934c301e5d914023a6687e63ccfe46b0c91d4c7a9ff830707be6 |
Hashes for cryptoauthlib-20241015-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf41967076ff407eb988e51627d5cddb904a41814cee3e04fb3a1129f627c8d0 |
|
MD5 | 46fecca007f24b8e27f89e9a3ec9be1d |
|
BLAKE2b-256 | 603e40c437b9aca26eed08b835425c0fe7a7172bbb6d1ad92829ba409b0017a4 |
Hashes for cryptoauthlib-20241015-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ca9f33016b91f19a06d7ab09b6c64b01ade670645faa0c06a22485c9541b2a9 |
|
MD5 | e7287c019e8f07f2028a1f9cae110f17 |
|
BLAKE2b-256 | c88f90165bd244821ca047bc02d8ac483661498e1a8ba73cad2b3c70d7fb8001 |
Hashes for cryptoauthlib-20241015-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33228315c1e9b0857d831821df9a1ab5cd33504c6758e9d9df3b1fbdd65b5f05 |
|
MD5 | 927cc0b75d8da3109883a403404d2789 |
|
BLAKE2b-256 | 6c3c09d62a62e56f145c5584cff711e193fbd97e8b22f0106da0e388a6bde48e |
Hashes for cryptoauthlib-20241015-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad76f12e9f74706d3710f754d9f0e3843a2e5cd0087187787e7864f7edbd0c9a |
|
MD5 | 6d7812820dbbc32733b9351be809f660 |
|
BLAKE2b-256 | 15304a033594d7bef07087221f8ca1407c0d41d9d72321673b9fabde08e2d104 |
Hashes for cryptoauthlib-20241015-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23fbd3d31bc3248ad918187bae965c02fc806493b7a7202cff89846abf925665 |
|
MD5 | 59e76a951239a8c5fd96fbf0814cf6f7 |
|
BLAKE2b-256 | 76f24115cc69bb3ae0d32ac254fc38379c6359159678da40a1c6d4d1973b718f |
Hashes for cryptoauthlib-20241015-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb0af346713668d27487d8db9a24f09be49835f4f7bb20dc293d673d59ec4d9f |
|
MD5 | 9b822e329c4b2a8c57d0d3c745247913 |
|
BLAKE2b-256 | a76c43af6a543786951a6a6a7c2cb3dffc41bc932dfd5f6de6a0b6231c2f5205 |
Hashes for cryptoauthlib-20241015-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2e3f2caba6be162cd6fbc294096a0ba97ed00e7f213415450a02ec591d1247f |
|
MD5 | d8b0f71383e9924bd403cff597ca2300 |
|
BLAKE2b-256 | 4b82bdad7a6721ac8723280ed0b22bd0c00fb649e486c60ec6ab4c28fe945bdb |
Hashes for cryptoauthlib-20241015-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d5d199538f3863d2225a8922719629d030d2ee54e5a6fba943b01b4b93c05da |
|
MD5 | 05b8fc7e3d3bdecfe07bff1e51f7e5d3 |
|
BLAKE2b-256 | c9780d245ae5dfe27191c7b16c51fe95e67322f814cc1ebc605783ebce2e8531 |
Hashes for cryptoauthlib-20241015-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5e8534ff5c910b77267dc0f1789c7762a77be12c1edc76bc708a2ba037f89ac |
|
MD5 | 6344f5cdc1c5a8787444041de4b4f001 |
|
BLAKE2b-256 | eda9dfeffed875cd88f1af912121810154084776d58c121e53ae510623f4019f |
Hashes for cryptoauthlib-20241015-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8c65fa787c4264cd51e0d42ff7d1e861ca48fdb19f7bd45c2faf30a561eaf5a |
|
MD5 | 17eb6d442340de0703527b112955c0a5 |
|
BLAKE2b-256 | 40bad5c72536113969edb3a1855891a037390574e600cc12ebb7713e751556e8 |
Hashes for cryptoauthlib-20241015-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ceaf4a00c127d2112bebcbbfd73b522e30e32a37e9bd677e173cbbc2a8898406 |
|
MD5 | 3d901d473c5c5dcff09fa025e371dde5 |
|
BLAKE2b-256 | e307b06ed8b28e2a05565f8901ceae43e320bbb902fadc80c0bac0cb8462fdcd |
Hashes for cryptoauthlib-20241015-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41057d46d224dcf4952dabf29e5f4a9160ee86561f298f126e21cf802f97031d |
|
MD5 | b841d14a6430472b8907437d16f1b2f4 |
|
BLAKE2b-256 | a9732a367174d0112676c726b5958b26e59514c7ef471793121bfc49671f4197 |
Hashes for cryptoauthlib-20241015-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2be00dacf24a0a4c863315a592060ae30af61d0a85ecbd58154885dde8b76836 |
|
MD5 | 9084ecb696dd510aa7d1445c7377872a |
|
BLAKE2b-256 | 1b6a6d10f0f7da436acac2db6e792e5255cfd7b8d21393404da64791e71d9768 |
Hashes for cryptoauthlib-20241015-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f81d1f67ea068b22a61854523446192b454db07a033cc11acb0d98cf5a33765 |
|
MD5 | 4a598d95bbed43e8368d1dc32507a3c9 |
|
BLAKE2b-256 | 7a79b4f8386ad361f164b1d3d0a8cfb40857bb00ddf017a3c838ceb9c4688f93 |
Hashes for cryptoauthlib-20241015-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fb458fabf41a511dc31c8756011884b6547b08c9d63e98c77af3c4b4d66190e |
|
MD5 | 995e91bda692f4f97c14d3a7905cdb00 |
|
BLAKE2b-256 | b65c3655ecee3cb68e9e9263dc927e17e1bc95c62fb3abf1ad94a48045d01bbf |
Hashes for cryptoauthlib-20241015-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d84d16f32d1756fd68585bb17bed7e4ee57b9cdd4f859b9081bdde2c252f274 |
|
MD5 | 04241cc828802ba7f062d630cc8b738d |
|
BLAKE2b-256 | 850a114e61176398c7baea2396b554bca3418ee35e21963732f0fb933837d34f |
Hashes for cryptoauthlib-20241015-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9b295e412b0e8a4ebd99acaf3a35d77c21889c3790454386905d511861f03cf |
|
MD5 | d9f7f98a124e9a3203c19eaee9a62140 |
|
BLAKE2b-256 | 3ba50ba335bd891f1b43af1af3c4caa1486bb4de61369b42cd35fbb9714f69ec |
Hashes for cryptoauthlib-20241015-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 913ef598b99cbd6fc8c7a0485c7cfa7a2ea9d2b7d3fadcf14105cf4d3ab538d9 |
|
MD5 | fc0f29dcc7997a1c59bf191374c2a2ca |
|
BLAKE2b-256 | 7c37571278feffa6276763de0f12eb77a712711690403a43b8565b5542e14cbf |
Hashes for cryptoauthlib-20241015-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5057e72e7a2f3cffd1d1dd2c6438a5ffd9bdba073c1f9008bf88c9a25c12247a |
|
MD5 | 4d1bc4a1ff5266c717ce9192207ec017 |
|
BLAKE2b-256 | 1adbc204a3041f882e972db898e13db59e440dcad2a76bc181b4d75726094a9e |
Hashes for cryptoauthlib-20241015-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6915820297d55e8dd223c69692e300cfa1fc0d6263b79296df5cae27935b5ea |
|
MD5 | 8b7f8e8ccdef54a055415260b96d48ae |
|
BLAKE2b-256 | 4ce303886ae6ab9a10fa2e07dfa39082db8245e093ab33037c37557840a44c3c |
Hashes for cryptoauthlib-20241015-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa1347998f19b7eeab668bd48dfd1a85ae5c53a6a1d2c1ef01538ec902f6977a |
|
MD5 | 85c6a105184f1ef8b906b17bf79fb9fb |
|
BLAKE2b-256 | 5482debdb944612871e74d619b7d23fa42df5a169f8a2677d05d1033db80d173 |
Hashes for cryptoauthlib-20241015-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7bf8f78c9523c17ad1c13d72767b35cf48989e7bb5e12feea12dbaba0ddbd2a |
|
MD5 | 224d488a195a27155971a230a9544a61 |
|
BLAKE2b-256 | 28021275a83c899c3d22d44e5f44e01794ab79a510f43fec47b15b699a386f76 |
Hashes for cryptoauthlib-20241015-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4401bcd88f032876057dc85424912e25da9547b620f2cdfc6f643a524a3c82b7 |
|
MD5 | 3a547d4cecc3abd52f270c8ae023dcaf |
|
BLAKE2b-256 | 40c70f8bd1a87b66f80d3c5b6e798b768ab77cafd3e04a1d6f663ffad2db04b1 |