Where did you get the hex version of the point? It does not look correct, its the wrong length. For the curve you picked, The field size is 21 bytes. The hex should be 04|x|y which would be 43 bytes, so string should be 86 bytes with a leading 04.
On 12/13/2012 12:23 AM, jeetendra gangele wrote:
Hi I have written below code but it always failed with EC_KEY_check_key failed: error:100A0066:lib(16):func(160):reason(102) 1 #include <stdio.h> 2 #include "openssl/sha.h" 3 #include <time.h> 4 5 #include <openssl/ecdsa.h> 6 #include <openssl/obj_mac.h> 7 #include <openssl/aes.h> 8 #include <openssl/ecdh.h> 9 #include <openssl/rand.h> 10 #include <string.h> 11 #include <openssl/ecdh.h> 12 #include <openssl/bn.h> 13 int main() 14 { 15 EC_KEY *key = NULL; 16 EC_POINT *pub_key; 17 const EC_GROUP *group; 18 19 20 key = EC_KEY_new_by_curve_name(NID_sect163k1); 21 group = EC_KEY_get0_group(key); 22 pub_key = EC_POINT_new(group); 23 24 EC_POINT_hex2point(group, 25 "369368AF243193D001E39CE76BB1D5DA08A9BC0A63307AB352338E5EA5C0E05A0C2531866F3E3C2702", pub_key, NULL); 26 27 EC_KEY_set_public_key(key, pub_key); 28 29 if (!EC_KEY_check_key(key)) { 30 printf("EC_KEY_check_key failed:\n"); 31 printf("%s\n",ERR_error_string(ERR_get_error(),NULL)); 32 } else { 33 printf("Public key verified OK\n"); 34 } 35 return 1; 36 } ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-...@openssl.org Automated List Manager majord...@openssl.org
-- Douglas E. Engert <deeng...@anl.gov> Argonne National Laboratory 9700 South Cass Avenue Argonne, Illinois 60439 (630) 252-5444 ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org