I recently started working with the LibTomCrypt Library because it claimed to be a well documented C Library to get started with Elliptic Curve Cryptography.
In my first little program I created an ECC key which I afterwards tried to print out. Therefore I used ecc_make_key and the ecc_export function.
unsigned char buf[4][4096]
// I do this for the private and public Key
ecc_export(keyBufPriv[0] /*keyBufPublic[0]*/, &x, PK_PRIVATE /* PK_PUBLIC */, &keyA)
for (int i = 0; i < x; i++) {
printf(" %d ", keyBuf[0][i]);
}
Printing them out I wondered why the public Key and the private Key seem to be very similar. There are a some test programs delivered with the library which show the same behavior. I added some printf lines similar to those above in the test program.
output from my program :
output from testprogram :
Due to the similarity between the private and public Key I am asking myself if everything of the libtomcryp
library runs as it should to make a secure ECC-Crypto.