I want to verify ECDSA signature using openssl. The EC point value i retrieve from ECDSA key pair that i generated using PKCS11. Below is the code that currently i have done.
VerifyEccData(int hashAlgo,BYTE *data,int dataLen,BYTE *signature,int
signatureLen,BYTE* curveType,BYTE* ecPoint,int ecPointLen)
{
const unsigned char * a = (unsigned char *)ecPoint + 2
EC_KEY *ec = EC_KEY_new();
int eccGrpSN = OBJ_txt2nid("secp112r1");
EC_GROUP *ecgroup = EC_GROUP_new_by_curve_name(eccGrpSN);
EC_KEY_set_group(ec,ecgroup );
o2i_ECPublicKey(&ec, &a, ecPointLen-2);
SHA1(data, dataLen,shaResult);
ECDSA_verify(0,shaResult, sizeof(shaResult), signature,signatureLen, ec);
}
Above code return
error:10067066:elliptic curve routines:ec_GFp_simple_oct2point:invalid encoding
I'm not sure what is the the meaning if this error. If anyone can help or point me to the right direction really appreciate.
I found this https://www.mail-archive.com/opensc-devel@lists.opensc-project.org/msg08847.html but when i try it give different error.
error:0D07209B:asn1 encoding routines:ASN1_get_object:too long