Reputation: 75
I'm trying to get the 64-byte signature after signing (ATECC608B) from buf
, but the returned size is 72, and sometimes varies between 70-72, depending on the size of hash
.
Any ideas on how I can get hold of the 64-byte signature?
ESP_LOGI(TAG, " Generating ECDSA Signature...");
ret = mbedtls_pk_sign(&pkey, MBEDTLS_MD_SHA256, hash, 0, buf, MBEDTLS_MPI_MAX_SIZE, &olen,
mbedtls_ctr_drbg_random, &ctr_drbg);
if (ret != 0)
{
ESP_LOGI(TAG, " failed ! mbedtls_pk_sign returned -0x%04x", -ret);
goto exit;
}
ESP_LOGI(TAG, " ok");
and here is how i'm trying to print it:
ESP_LOGI(TAG, "Signature:");
ESP_LOGW(TAG, "%i", olen);
ESP_LOG_BUFFER_HEX_LEVEL(TAG, buf, olen, ESP_LOG_WARN);
I (649) atecc_example: Signature:
W (649) atecc_example: 72
W (649) atecc_example: 30 46 02 21 00 f6 8b 21 9f 60 47 d3 f7 99 e0 a4
W (649) atecc_example: a1 0b df 4d d3 78 36 3e d1 0c 2c 34 4c 14 39 6d
W (659) atecc_example: 2f 5c cb 43 bc 02 21 00 bd 20 87 ed fa fa 81 db
W (669) atecc_example: 02 df 82 0e 3c 3d 5a 35 c3 6b c5 0d cb 35 d2 e1
W (679) atecc_example: 7b 3a 3a ca 21 59 6b cc
The example seems to sign and verify the message successfully, but my problem is getting the 64-byte signature.
Appreciate any advice!
Links: Example code Datasheet
Upvotes: 2
Views: 160