HI I tried the below code but still failed. below is my keys also ec -in ec_key.pem -noout -text read EC key Private-Key: (224 bit) priv: 00:ca:9e:dd:d8:f0:e0:48:35:2c:f7:82:33:24:61: 78:36:df:0d:83:8f:b6:02:97:b1:e3:29:4e:e4 pub: 04:ca:92:89:e7:00:51:43:28:64:89:e5:ed:36:2e: 65:64:76:dd:af:5e:ff:a4:ee:a2:d8:f5:94:e3:35: a1:62:4a:8a:09:c7:45:0d:00:9d:a5:00:fd:72:21: 16:d4:b8:bb:74:d3:88:5c:9d:de:13:04 Can i load only private part of the key while signing the data? In the below code check check itself failing.
Can you guide me? what worong here static int loadkey_ecdsa() 36 { 37 BIGNUM start; 38 BIGNUM *res; 39 EC_KEY *pkey=EC_KEY_new_by_curve_name(NID_secp224r1); 40 BN_CTX *ctx; 41 int ret =0; 42 ERR_load_crypto_strings(); 43 BN_init(&start); 44 ctx = BN_CTX_new(); 45 EC_POINT *pub_key; 46 res = &start; 47 char b1[] = "00ca9eddd8f0e048352cf7823324617836df0d838fb60297b1e3294ee4"; 48 EC_GROUP *ecgroup= EC_GROUP_new_by_curve_name(NID_secp224r1); 49 int set_group_status = EC_KEY_set_group(pkey,ecgroup); 50 pub_key = EC_POINT_new(ecgroup); 51 BN_hex2bn(&res,b1); 52 EC_KEY_set_private_key(pkey, res); 53 res = BN_copy(res, EC_KEY_get0_private_key(pkey)); 54 55 char *result_str = NULL; 56 if(res == NULL) 57 { 58 printf("hello"); 59 } 60 result_str = BN_bn2hex(res); 61 if(result_str == NULL) 62 { 63 printf("hello"); 64 } 65 char err[120]; 66 printf("%s\n",result_str ); 67 68 if (!EC_KEY_check_key(pkey)) { 69 printf("EC_KEY_check_key failed:\n"); 70 printf("%d%s\n",__LINE__,ERR_error_string(ERR_get_error(),err)); 71 printf("and erro is %s\n",err); 72 } else { 73 printf("Public key verified OK\n"); 74 } 75 76 BN_free(res); 77 78 BN_CTX_free(ctx); 79 } On 14 December 2012 15:00, Dave Thompson <dthomp...@prinpay.com> wrote: > openssl ecparam -out ec_key.pem -name secp224r1 -genkey ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org