|
cryptnox-sdk-arduino 1.0.0
Arduino library for Cryptnox Hardware Wallet
|
#include <CryptnoxWallet.h>#include <SPI.h>Go to the source code of this file.
Macros | |
| #define | PN532_SS_PIN (10U) |
| SPI slave-select (CS) pin connected to the PN532 module. | |
| #define | DEMO_PIN "000000000" |
| Demo PIN used by this example. Must match the PIN that the card was initialised with (4–9 ASCII digits). | |
Functions | |
| PN532Adapter | nfc (serialAdapter, PN532_SS_PIN, &SPI) |
| PN532 transport adapter over SPI. | |
| void | setup () |
| Arduino setup hook. | |
| void | loop () |
| Arduino main loop. | |
Variables | |
| ArduinoLoggerAdapter | serialAdapter |
Arduino logger adapter — emits SDK diagnostics on Serial. | |
| ArduinoCryptoProvider | cryptoProvider |
| Crypto provider (AES / SHA / micro-ecc / TRNG bridge for Arduino). | |
| ArduinoPlatform | platform |
| Platform adapter (Arduino blocking delay). | |
| CryptnoxWallet | wallet (nfc, serialAdapter, cryptoProvider, platform) |
| High-level Cryptnox wallet wiring the four adapters together. | |
| #define DEMO_PIN "000000000" |
Demo PIN used by this example. Must match the PIN that the card was initialised with (4–9 ASCII digits).
Definition at line 50 of file Sign.ino.
Referenced by loop().
| #define PN532_SS_PIN (10U) |
| void loop | ( | ) |
Arduino main loop.
One full sign session per iteration on the happy path:
On CW_SIGN_PIN_INCORRECT the sketch enters an infinite halt to protect the card's retry counter. Other non-OK error codes are reported but the loop continues (those errors do not consume PIN tries).
The 1 s delay between successful iterations gives time to remove/replace the card and keeps the Serial output readable.
Definition at line 100 of file Sign.ino.
References CW_HASH_SIZE, CW_OK, CW_SIG_R_OFFSET, CW_SIG_S_OFFSET, CW_SIGN_CURR_K1, CW_SIGN_PIN_INCORRECT, CW_SIGN_SIG_ECDSA_LOW_S, CW_SIGN_WITH_PIN, DEMO_PIN, CW_SignResult::errorCode, F, CW_SignRequest::hash, CW_SignRequest::hashLength, HEX, CW_SignRequest::pin, CW_Utils::safe_memcpy(), CW_Utils::secure_wipe(), serialAdapter, CW_SignResult::signature, and wallet.
| PN532Adapter nfc | ( | serialAdapter | , |
| PN532_SS_PIN | , | ||
| & | SPI ) |
PN532 transport adapter over SPI.
References PN532_SS_PIN, and serialAdapter.
| void setup | ( | ) |
Arduino setup hook.
Brings up Serial, the SPI bus and the PN532 reader. Halts on init failure (no reader detected) so the user can inspect the Serial output.
Definition at line 73 of file Sign.ino.
References F, serialAdapter, and wallet.
| ArduinoCryptoProvider cryptoProvider |
| ArduinoPlatform platform |
| ArduinoLoggerAdapter serialAdapter |
| CryptnoxWallet wallet(nfc, serialAdapter, cryptoProvider, platform) | ( | nfc | , |
| serialAdapter | , | ||
| cryptoProvider | , | ||
| platform | ) |
High-level Cryptnox wallet wiring the four adapters together.