cryptnox-sdk-arduino 1.0.0
Arduino library for Cryptnox Hardware Wallet
Loading...
Searching...
No Matches
Sign.ino File Reference
#include <CryptnoxWallet.h>
#include <SPI.h>
Include dependency graph for Sign.ino:

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.

Macro Definition Documentation

◆ DEMO_PIN

#define DEMO_PIN   "000000000"

Demo PIN used by this example. Must match the PIN that the card was initialised with (4–9 ASCII digits).

Examples
Sign.ino, and VerifyPin.ino.

Definition at line 50 of file Sign.ino.

Referenced by loop().

◆ PN532_SS_PIN

#define PN532_SS_PIN   (10U)

SPI slave-select (CS) pin connected to the PN532 module.

Definition at line 44 of file Sign.ino.

Function Documentation

◆ loop()

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.

◆ nfc()

PN532 transport adapter over SPI.

References PN532_SS_PIN, and serialAdapter.

◆ setup()

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.

Variable Documentation

◆ cryptoProvider

ArduinoCryptoProvider cryptoProvider

Crypto provider (AES / SHA / micro-ecc / TRNG bridge for Arduino).

Definition at line 59 of file Sign.ino.

◆ platform

ArduinoPlatform platform

Platform adapter (Arduino blocking delay).

Definition at line 62 of file Sign.ino.

◆ serialAdapter

ArduinoLoggerAdapter serialAdapter

Arduino logger adapter — emits SDK diagnostics on Serial.

Definition at line 53 of file Sign.ino.

◆ wallet

High-level Cryptnox wallet wiring the four adapters together.