Python SDK for managing Cryptnox smart card wallets.
Project description
Python SDK for managing Cryptnox smart card wallets.
cryptnox_sdk_py is a Python 3 library used to communicate with the Cryptnox Smartcard Applet.
It provides a high-level API to manage Cryptnox Hardware Wallet Cards, including initialization,
secure channel setup, seed management, and cryptographic signing.
Supported hardware
- Cryptnox smart cards 💳
- Standard PC/SC smart card readers: either USB NFC reader or a USB smart card reader → Readers are also available in the Cryptnox shop.
Get your cards and readers here: shop.cryptnox.com
Features
- Establish communication with Cryptnox smart cards
- Initialize and manage card lifecycle
- Secure channel authentication and pairing
- Seed generation and restoration (BIP32 / BIP39 compatibility)
- ECDSA secp256k1 signing for blockchain applications
Installation
pip install cryptnox_sdk_py
Or from source:
git clone https://github.com/Cryptnox-Software/cryptnox_sdk_py.git
pip install .
Requires:
- Python 3.11–3.13
- PC/SC Smart Card service (
pcscd) on Linux
On Linux, ensure the PC/SC service is running:
sudo systemctl start pcscd
sudo systemctl enable pcscd
Quick usage examples
1. Connect to a Cryptnox Card
import cryptnox_sdk_py
from cryptnox_sdk_py import exceptions
connection = None
try:
connection = cryptnox_sdk_py.Connection(0)
card = cryptnox_sdk_py.factory.get_card(connection)
# Card is loaded and can be used
print(f"Card serial number: {card.serial_number}")
except exceptions.ReaderException:
print("Reader not found at index")
except exceptions.CryptnoxException as error:
# Issue loading the card
print(error)
finally:
# Always close the connection when done
if connection:
connection.disconnect()
2. Test PIN code
In the PIN verification example below the card must be initialized before calling verify_pin.
import cryptnox_sdk_py
from cryptnox_sdk_py import exceptions
connection = None
try:
# Connect to the Cryptnox card first
connection = cryptnox_sdk_py.Connection(0) # Connect to card at index 0
card = cryptnox_sdk_py.factory.get_card(connection)
# Once connected, verify the PIN
pin_to_test = "1234" # Example PIN
card.verify_pin(pin_to_test)
print("PIN verified successfully. Card is ready for operations.")
except exceptions.ReaderException:
print("Reader not found at index")
except exceptions.CryptnoxException as error:
print(f"Error loading card: {error}")
except exceptions.PinException:
print("Invalid PIN code.")
except exceptions.DataValidationException:
print("Invalid PIN length or PIN authentication disabled.")
except exceptions.SoftLock:
print("Card is locked. Please power cycle the card.")
finally:
# Always close the connection when done
if connection:
connection.disconnect()
3. Generate a new seed
In the example below the card must be init before generating a seed.
import binascii
import cryptnox_sdk_py
from cryptnox_sdk_py import exceptions
PIN = "1234" # or "" if the card was opened via challenge-response
def main():
connection = None
try:
connection = cryptnox_sdk_py.Connection(0)
card = cryptnox_sdk_py.factory.get_card(connection)
seed_uid = card.generate_seed(PIN)
# seed_uid is of type bytes: display in hex for readability
print("Seed (primary node m) UID:", binascii.hexlify(seed_uid).decode())
except exceptions.ReaderException:
print("Reader not found at index")
except exceptions.CryptnoxException as err:
print(f"Error loading card: {err}")
except exceptions.KeyAlreadyGenerated:
print("A seed is already generated on this card.")
except exceptions.KeyGenerationException as err:
print(f"Failed to generate seed: {err}")
finally:
# Always close the connection when done
if connection:
connection.disconnect()
if __name__ == "__main__":
main()
Documentation
📚 Full API reference: https://cryptnox-software.github.io/cryptnox_sdk_py
License
- This library is available under LGPL-3.0+.
- For commercial licensing options, contact: info@cryptnox.ch
========= Changelog
1.0.1 <https://github.com/Cryptnox-Software/cryptnox_sdk_py/compare/v1.0.0...v1.0.1>_
Changed ^^^^^^^
- Package renamed from
cryptnoxpytocryptnox_sdk_py
2.5.5 <https://github.com/Cryptnox-Software/cryptnox-sdk-py/releases/tag/v2.5.5>_ - 2025-09-29
Changed ^^^^^^^
- Handled get public key clear with different public key formats
Fixed ^^^^^
- Resolved card detection by implementing x509 parsing
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cryptnox_sdk_py-1.0.1.tar.gz.
File metadata
- Download URL: cryptnox_sdk_py-1.0.1.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
799b9bc38e81497b7677e65d2bd44bbc32d8ac9e52481967de2adb8ecbc519cb
|
|
| MD5 |
86102ad4a724fcbf20bf545a6dc8d121
|
|
| BLAKE2b-256 |
f298779d2e9b5d7481b9b7e288d30dda429963368d773a22898310ca09ea10a7
|
File details
Details for the file cryptnox_sdk_py-1.0.1-py3-none-any.whl.
File metadata
- Download URL: cryptnox_sdk_py-1.0.1-py3-none-any.whl
- Upload date:
- Size: 47.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a39f002309309236e9fd64e8be9e668dc26c1c99712ea8781473568e158fdc7
|
|
| MD5 |
544da775de6f4854dd7b08637165bc40
|
|
| BLAKE2b-256 |
416ec62dbc0fdc29a69dab1218cfbb72f4ad8b3b96231d7dbdfe5d401a15b984
|