|
cryptnox-sdk-arduino 1.0.0
Arduino library for Cryptnox Hardware Wallet
|
Shared constants, error codes, and session state for the SDK. More...
Go to the source code of this file.
Classes | |
| struct | CW_SecureSession |
| Holds cryptographic session state for reentrant secure channel operations. More... | |
Enumerations | |
| enum | CW_Curve { CW_CURVE_SECP256R1 = 0 , CW_CURVE_SECP256K1 = 1 } |
| Portable curve identifier used throughout the SDK. More... | |
Shared constants, error codes, and session state for the SDK.
Defines:
CW_OK, CW_NOK, CW_SIGN_*)CW_CERT_*)CW_VERIFY_CERT, CW_DEBUG_LOGGING Definition in file CW_Defs.h.
| #define CW_AESKEY_SIZE (32U) |
AES-256 session encryption key size in bytes
Definition at line 75 of file CW_Defs.h.
Referenced by CryptnoxWallet::isSecureChannelOpen(), and CW_SecureChannel::mutuallyAuthenticate().
| #define CW_CERT_CARD_SIG_INVALID (0x12U) |
Card cert ECDSA sig failed
Definition at line 130 of file CW_Defs.h.
Referenced by CW_SecureChannel::verifyCertificateChain().
| #define CW_CERT_FORMAT_ERROR (0x10U) |
Malformed certificate data
Definition at line 128 of file CW_Defs.h.
Referenced by CW_SecureChannel::verifyCertificateChain().
| #define CW_CERT_KEY_NOT_FOUND (0x14U) |
Device public key OID not found
Definition at line 132 of file CW_Defs.h.
Referenced by CW_SecureChannel::verifyCertificateChain().
| #define CW_CERT_MANUF_SIG_INVALID (0x13U) |
Manufacturer cert ECDSA sig failed
Definition at line 131 of file CW_Defs.h.
Referenced by CW_SecureChannel::verifyCertificateChain().
| #define CW_CERT_NONCE_MISMATCH (0x11U) |
Challenge nonce not echoed
Definition at line 129 of file CW_Defs.h.
Referenced by CW_SecureChannel::verifyCertificateChain().
| #define CW_CERT_NONCE_SIZE (8U) |
Challenge nonce length in bytes
Definition at line 124 of file CW_Defs.h.
Referenced by CW_SecureChannel::verifyCertificateChain().
| #define CW_CERT_OK (0x00U) |
Certificate chain verified
Definition at line 127 of file CW_Defs.h.
Referenced by CryptnoxWallet::establishSecureChannel(), and CW_SecureChannel::verifyCertificateChain().
| #define CW_CONNECT_MAX_ATTEMPTS (5U) |
Max NFC connection retry attempts
Definition at line 113 of file CW_Defs.h.
Referenced by CryptnoxWallet::connect().
| #define CW_DEBUG_LOGGING 0 |
Set to 1 to enable library-internal debug logging via CW_Logger.
Off by default. Enabling it kills flash optimisation — measured on Arduino UNO R4 (Renesas RA4M1): +149 KB flash, +6 KB SRAM (31 % → 88 % of a 256 KB image on the Sign example). Same order of magnitude on every constrained MCU.
Also leaks session state over UART (SEC-012). Bring-up only, never in release builds.
| #define CW_DER_TAG_INTEGER (0x02U) |
Definition at line 121 of file CW_Defs.h.
Referenced by CryptnoxWallet::parseDerSignature().
| #define CW_DER_TAG_SEQUENCE (0x30U) |
Definition at line 120 of file CW_Defs.h.
Referenced by CryptnoxWallet::extractRawSignature(), and CryptnoxWallet::parseDerSignature().
| #define CW_HASH_SIZE (32U) |
Standard hash size
Definition at line 108 of file CW_Defs.h.
Referenced by CryptnoxWallet::buildSignPayload(), loop(), setup(), CryptnoxWallet::sign(), and CryptnoxWallet::validateSignRequest().
| #define CW_INVALID_SESSION (0x02U) |
Invalid session
Definition at line 82 of file CW_Defs.h.
Referenced by CryptnoxWallet::validateSignRequest().
| #define CW_IV_SIZE (16U) |
AES-CBC IV size in bytes
Definition at line 77 of file CW_Defs.h.
Referenced by CW_SecureChannel::aesCbcEncrypt(), and CW_SecureChannel::mutuallyAuthenticate().
| #define CW_MACKEY_SIZE (32U) |
AES-256 session MAC key size in bytes
Definition at line 76 of file CW_Defs.h.
Referenced by CW_SecureChannel::mutuallyAuthenticate().
| #define CW_MANUF_CERT_MAX_BYTES (420U) |
Definition at line 136 of file CW_Defs.h.
Referenced by CW_SecureChannel::getManufacturerCertificate().
| #define CW_MAX_DERIVE_PATH_LENGTH (20U) |
Max BIP32 path bytes
Definition at line 109 of file CW_Defs.h.
Referenced by CryptnoxWallet::buildSignPayload(), and CryptnoxWallet::sign().
| #define CW_MAX_PIN_LENGTH (9U) |
Maximum PIN length
Definition at line 111 of file CW_Defs.h.
Referenced by CryptnoxWallet::buildSignPayload(), CryptnoxWallet::sign(), CryptnoxWallet::validateSignRequest(), and CryptnoxWallet::verifyPin().
| #define CW_MIN_PIN_LENGTH (4U) |
Minimum PIN length
Definition at line 110 of file CW_Defs.h.
Referenced by CryptnoxWallet::validateSignRequest(), and CryptnoxWallet::verifyPin().
| #define CW_NOK (0x01U) |
NOK
Definition at line 81 of file CW_Defs.h.
Referenced by CW_SignResult::CW_SignResult(), and CryptnoxWallet::extractRawSignature().
| #define CW_OK (0x00U) |
OK
Definition at line 80 of file CW_Defs.h.
Referenced by loop(), setup(), and CryptnoxWallet::sign().
| #define CW_RAW_SIGNATURE_SIZE (64U) |
Raw signature (r[32] + s[32])
Definition at line 107 of file CW_Defs.h.
Referenced by CryptnoxWallet::debugPrintSignature(), and CryptnoxWallet::extractRawSignature().
| #define CW_SIG_R_OFFSET (0U) |
Byte offset of the r component
Definition at line 116 of file CW_Defs.h.
Referenced by loop().
| #define CW_SIG_S_OFFSET (32U) |
Byte offset of the s component
Definition at line 117 of file CW_Defs.h.
Referenced by loop().
| #define CW_SIGN_CURR_K1 (0x00U) |
Current key (k1)
Definition at line 85 of file CW_Defs.h.
Referenced by CW_SignRequest::CW_SignRequest(), and loop().
| #define CW_SIGN_DERIVE_K1 (0x01U) |
Derive with k1 curve
Definition at line 87 of file CW_Defs.h.
Referenced by CryptnoxWallet::buildSignPayload(), and setup().
| #define CW_SIGN_DERIVE_R1 (0x11U) |
Derive with r1 curve
Definition at line 88 of file CW_Defs.h.
Referenced by CryptnoxWallet::buildSignPayload().
| #define CW_SIGN_KEY_TOO_SHORT (0x80U) |
Definition at line 101 of file CW_Defs.h.
Referenced by CryptnoxWallet::validateSignRequest().
| #define CW_SIGN_KEY_TOO_SHORT_WITH_PINLESS_MODE (0x83U) |
Definition at line 104 of file CW_Defs.h.
Referenced by CryptnoxWallet::validateSignRequest().
| #define CW_SIGN_NO_KEY_LOADED (0x81U) |
Definition at line 102 of file CW_Defs.h.
Referenced by CryptnoxWallet::sendSignApdu(), and setup().
| #define CW_SIGN_PIN_INCORRECT (0x82U) |
Definition at line 103 of file CW_Defs.h.
Referenced by loop(), setup(), and CryptnoxWallet::validateSignRequest().
| #define CW_SIGN_PINLESS_K1 (0x03U) |
PIN-less path (k1 only)
Definition at line 89 of file CW_Defs.h.
Referenced by CryptnoxWallet::validateSignRequest().
| #define CW_SIGN_SIG_ECDSA_LOW_S (0x00U) |
ECDSA with canonical low S
Definition at line 96 of file CW_Defs.h.
Referenced by CW_SignRequest::CW_SignRequest(), loop(), and setup().
| #define CW_SIGN_WITH_PIN (false) |
PIN path
Definition at line 92 of file CW_Defs.h.
Referenced by CW_SignRequest::CW_SignRequest(), loop(), and setup().
| #define CW_USER_DATA_PAGE_SIZE (208U) |
Max plaintext bytes per write user data page
Definition at line 112 of file CW_Defs.h.
Referenced by CryptnoxWallet::writeUserData().