cryptnox-sdk-arduino 1.0.0
Arduino library for Cryptnox Hardware Wallet
Loading...
Searching...
No Matches
CW_CryptoProvider.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: LGPL-3.0-or-later
3 * Copyright (c) 2026 Cryptnox SA
4 */
5
20
21#ifndef CW_CRYPTOPROVIDER_H
22#define CW_CRYPTOPROVIDER_H
23
24/******************************************************************
25 * 1. Included files
26 ******************************************************************/
27
28#include "platform_compat.h"
29#include "CW_Defs.h"
30
31/******************************************************************
32 * 2. Class declaration
33 ******************************************************************/
34
46public:
55 virtual bool sha256(const uint8_t* data, size_t len, uint8_t* out) = 0;
56
65 virtual bool sha512(const uint8_t* data, size_t len, uint8_t* out) = 0;
66
80 virtual uint16_t aesCbcEncrypt(const uint8_t* in, uint16_t len, uint8_t* out,
81 const uint8_t* key, uint8_t keyLen,
82 uint8_t* iv, bool bitPadding) = 0;
83
96 virtual uint16_t aesCbcDecrypt(uint8_t* in, uint16_t len, uint8_t* out,
97 const uint8_t* key, uint8_t keyLen,
98 uint8_t* iv, bool bitPadding) = 0;
99
109 virtual bool ecdh(const uint8_t* pubKey, const uint8_t* privKey,
110 uint8_t* secret, CW_Curve curve) = 0;
111
120 virtual bool makeKey(uint8_t* pubKey, uint8_t* privKey,
121 CW_Curve curve) = 0;
122
130 virtual bool random(uint8_t* dest, unsigned size) = 0;
131
142 virtual bool ecdsaVerify(const uint8_t* pubKey64,
143 const uint8_t* hash, size_t hashLen,
144 const uint8_t* sig, CW_Curve curve) = 0;
145
147};
148
149#endif // CW_CRYPTOPROVIDER_H
Shared constants, error codes, and session state for the SDK.
Abstract interface for cryptographic operations used by CW_SecureChannel.
virtual bool sha512(const uint8_t *data, size_t len, uint8_t *out)=0
Compute SHA-512 over a contiguous data buffer.
virtual bool ecdsaVerify(const uint8_t *pubKey64, const uint8_t *hash, size_t hashLen, const uint8_t *sig, CW_Curve curve)=0
Verify an ECDSA signature (raw r||s, 64 bytes) against a message hash.
virtual bool random(uint8_t *dest, unsigned size)=0
Fill a buffer with cryptographically random bytes.
virtual uint16_t aesCbcDecrypt(uint8_t *in, uint16_t len, uint8_t *out, const uint8_t *key, uint8_t keyLen, uint8_t *iv, bool bitPadding)=0
AES-CBC decrypt.
virtual bool ecdh(const uint8_t *pubKey, const uint8_t *privKey, uint8_t *secret, CW_Curve curve)=0
ECDH shared secret computation.
virtual bool sha256(const uint8_t *data, size_t len, uint8_t *out)=0
Compute SHA-256 over a contiguous data buffer.
virtual uint16_t aesCbcEncrypt(const uint8_t *in, uint16_t len, uint8_t *out, const uint8_t *key, uint8_t keyLen, uint8_t *iv, bool bitPadding)=0
AES-CBC encrypt.
virtual bool makeKey(uint8_t *pubKey, uint8_t *privKey, CW_Curve curve)=0
Generate a new EC key pair.
CW_Curve
Portable curve identifier used throughout the SDK.
Definition CW_Defs.h:151
Arduino compatibility shims for non-Arduino (plain C++) builds.