Skip to content Skip to sidebar Skip to footer

Ecdsa Signing And Verifying Issue Between Python Ecdsa And C Micro-ecc Library

I am facing an issue when I do the following : Created a Public Private key pair using python for ECDSA SECP256k1 curve and printed it on the terminal. Copy pasted the key pair

Solution 1:

The ECDSA signing procedure is a two-stage process:

  • a hash digest is calculated from the message
  • this digest is then signed.

Python ECDSA uses SHA-1 by default unless otherwise stated.

The SHA-1 digest for the message 'Hello' is hex encoded: f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0.

This means you need to use this digest when calling the uECC_verify function.

Validation

Replace in your .c code the msg array with the following line of code:

uint8_t msg[] = { 0xf7, 0xff, 0x9e, 0x8b, 0x7b, 0xb2, 0xe0, 0x9b, 0x70, 0x93, 0x5a, 0x5d, 0x78, 0x5e, 0x0c, 0xc5, 0xd9, 0xd0, 0xab, 0xf0};

Then the verfiy function succeeds.

Output

The output in the debug console looks like this:

uECC_verify output

Post a Comment for "Ecdsa Signing And Verifying Issue Between Python Ecdsa And C Micro-ecc Library"