Hi Amit,
just throw my thought, hope it helps.
Could you have test using below example codes?
It's trying to load ECC key pairs, then decode -> export private key.
the private key will be exported to derKey, and length is derKeySz.
========= Examples ==============
ecc_key priKey;
int derKeySz;
FILE* priFile;
byte tmp[TWOK_BUF];
word32 idx = 0;
int ret;
priFile= fopen(xxx.key, "rb");
if (!priFile)
{
printf("\r\nLoad Private Key fail.");
return;
}
derKeySz = fread(tmp, 1, TWOK_BUF, priFile);
fclose(priFile);
ret = EccPrivateKeyDecode(tmp, &idx, &priKey, (word32)derKeySz);
if (ret != 0) {
printf("\r\nEccPrivateKeyDecode fail.");
return;
}
ret = ecc_export_private_only (&priKey, derKey, &derKeySz);
if (ret != 0)
{
printf ("<%s> Fail!\n", __func__);
return;
}