cryptnox-sdk-arduino 1.0.0
Arduino library for Cryptnox Hardware Wallet
Loading...
Searching...
No Matches
StubCrypto Class Referencefinal
Inheritance diagram for StubCrypto:
[legend]
Collaboration diagram for StubCrypto:
[legend]

Public Member Functions

bool sha256 (const uint8_t *, size_t, uint8_t *) override
 Compute SHA-256 over a contiguous data buffer.
bool sha512 (const uint8_t *, size_t, uint8_t *) override
 Compute SHA-512 over a contiguous data buffer.
uint16_t aesCbcEncrypt (const uint8_t *, uint16_t, uint8_t *, const uint8_t *, uint8_t, uint8_t *, bool) override
 AES-CBC encrypt.
uint16_t aesCbcDecrypt (uint8_t *, uint16_t, uint8_t *, const uint8_t *, uint8_t, uint8_t *, bool) override
 AES-CBC decrypt.
bool ecdh (const uint8_t *, const uint8_t *, uint8_t *, CW_Curve) override
 ECDH shared secret computation.
bool makeKey (uint8_t *, uint8_t *, CW_Curve) override
 Generate a new EC key pair.
bool random (uint8_t *, unsigned) override
 Fill a buffer with cryptographically random bytes.
bool ecdsaVerify (const uint8_t *, const uint8_t *, size_t, const uint8_t *, CW_Curve) override
 Verify an ECDSA signature (raw r||s, 64 bytes) against a message hash.
Public Member Functions inherited from CW_CryptoProvider
virtual ~CW_CryptoProvider ()

Detailed Description

Definition at line 82 of file fuzz_der.cpp.

Member Function Documentation

◆ aesCbcDecrypt()

uint16_t StubCrypto::aesCbcDecrypt ( uint8_t * in,
uint16_t len,
uint8_t * out,
const uint8_t * key,
uint8_t keyLen,
uint8_t * iv,
bool bitPadding )
inlineoverridevirtual

AES-CBC decrypt.

Parameters
[in]inCiphertext input buffer (non-const; may be modified internally).
[in]lenLength of the ciphertext.
[out]outPlaintext output buffer.
[in]keyAES key bytes.
[in]keyLenAES key length in bytes.
[in,out]iv16-byte IV used as decrypt IV.
[in]bitPaddingtrue = Bit padding removal; false = Null padding (no removal).
Returns
Length of the plaintext written to out.

Implements CW_CryptoProvider.

Definition at line 89 of file fuzz_der.cpp.

◆ aesCbcEncrypt()

uint16_t StubCrypto::aesCbcEncrypt ( const uint8_t * in,
uint16_t len,
uint8_t * out,
const uint8_t * key,
uint8_t keyLen,
uint8_t * iv,
bool bitPadding )
inlineoverridevirtual

AES-CBC encrypt.

Parameters
[in]inPlaintext input buffer.
[in]lenLength of the plaintext.
[out]outCiphertext output buffer (must be large enough for padding).
[in]keyAES key bytes.
[in]keyLenAES key length in bytes (16, 24, or 32).
[in,out]iv16-byte IV; updated to last cipher block on return.
[in]bitPaddingtrue = ISO/IEC 9797-1 Method 2 (Bit) padding; false = Null padding (no padding added).
Returns
Length of the ciphertext written to out.

Implements CW_CryptoProvider.

Definition at line 86 of file fuzz_der.cpp.

◆ ecdh()

bool StubCrypto::ecdh ( const uint8_t * pubKey,
const uint8_t * privKey,
uint8_t * secret,
CW_Curve curve )
inlineoverridevirtual

ECDH shared secret computation.

Parameters
[in]pubKeyRemote public key (64 bytes, X||Y, no 0x04 prefix).
[in]privKeyLocal private key (32 bytes).
[out]secret32-byte shared secret output.
[in]curveCurve identifier (CW_CURVE_SECP256R1 or CW_CURVE_SECP256K1).
Returns
true on success, false otherwise.

Implements CW_CryptoProvider.

Definition at line 92 of file fuzz_der.cpp.

◆ ecdsaVerify()

bool StubCrypto::ecdsaVerify ( const uint8_t * pubKey64,
const uint8_t * hash,
size_t hashLen,
const uint8_t * sig,
CW_Curve curve )
inlineoverridevirtual

Verify an ECDSA signature (raw r||s, 64 bytes) against a message hash.

Parameters
[in]pubKey6464-byte public key (X||Y, no 0x04 prefix).
[in]hashMessage hash buffer.
[in]hashLenLength of the hash in bytes.
[in]sig64-byte raw signature (r[32]||s[32]).
[in]curveCurve identifier for the verification operation.
Returns
true if the signature is valid, false otherwise.

Implements CW_CryptoProvider.

Definition at line 97 of file fuzz_der.cpp.

◆ makeKey()

bool StubCrypto::makeKey ( uint8_t * pubKey,
uint8_t * privKey,
CW_Curve curve )
inlineoverridevirtual

Generate a new EC key pair.

Parameters
[out]pubKey64-byte public key output (X||Y, no prefix).
[out]privKey32-byte private key output.
[in]curveCurve identifier (CW_CURVE_SECP256R1 or CW_CURVE_SECP256K1).
Returns
true on success, false otherwise.

Implements CW_CryptoProvider.

Definition at line 94 of file fuzz_der.cpp.

◆ random()

bool StubCrypto::random ( uint8_t * dest,
unsigned size )
inlineoverridevirtual

Fill a buffer with cryptographically random bytes.

Parameters
[out]destBuffer to fill.
[in]sizeNumber of bytes to generate.
Returns
true on success, false otherwise.

Implements CW_CryptoProvider.

Definition at line 96 of file fuzz_der.cpp.

◆ sha256()

bool StubCrypto::sha256 ( const uint8_t * data,
size_t len,
uint8_t * out )
inlineoverridevirtual

Compute SHA-256 over a contiguous data buffer.

Parameters
[in]dataInput buffer.
[in]lenNumber of bytes to hash.
[out]out32-byte output buffer.
Returns
true on success, false if the underlying hash accelerator faults.

Implements CW_CryptoProvider.

Definition at line 84 of file fuzz_der.cpp.

◆ sha512()

bool StubCrypto::sha512 ( const uint8_t * data,
size_t len,
uint8_t * out )
inlineoverridevirtual

Compute SHA-512 over a contiguous data buffer.

Parameters
[in]dataInput buffer.
[in]lenNumber of bytes to hash.
[out]out64-byte output buffer.
Returns
true on success, false if the underlying hash accelerator faults.

Implements CW_CryptoProvider.

Definition at line 85 of file fuzz_der.cpp.


The documentation for this class was generated from the following file: