0

int EC_POINT_set_compressed_coordinates_GFp (const EC_GROUP *group, EC_POINT *p, const BIGNUM *x, int y_bit, BN_CTX *ctx);

I just want to set the randomly generated ECDH public key as the X9.62 compressed coordinate of a point over GFp for group P-256 , assuming 0 as the y-bit.

but that randomly generated ECDH public key is in hex string(already converted to some format to hex string)?

CPPDev
  • 1
  • 1
  • Assuming a usual C string (char array terminated by null byte), use **BN_hex2bn** to convert hex string to BIGNUM object. – dave_thompson_085 Mar 23 '22 at 18:43
  • Thank you @dave_thompson_085 for responding. yes I converted to BIGNUM object. const EC_GROUP *group, EC_POINT *p, const BIGNUM *x, int y_bit, BN_CTX *ctx if you tell me what are the parameters I have take for the function, That would be more helpful. Thank you in advance. – CPPDev Mar 24 '22 at 09:00
  • There are all described on the man page (note: read from the paragraph on EC_point_set_affine_coordinates through the ones on EC_point_set_compressed_coordinates because they are interrelated) except for ctx which is described on the man page for BN_CTX_{new,free,...} and which for a single call you don't need (just pass NULL). – dave_thompson_085 Mar 25 '22 at 01:54

0 Answers0