Hi All,

I have to prove below things using openssl.

Ca.Sa.G  = Sa.Ca.G
 * Client *:- private = Ca , public= Ca,G and *Server*:- private=Sa, pub =
Sa.G

I have written the below code for that but dont know how to proceed further
. Please help

void handleErrors(void){

printf("\n Error ");
}


void myPrint( BIGNUM * x, char * t ) {
   char * s = BN_bn2dec( x ) ;
   printf("%s%s\n", t, s ) ;
//   OPENSSL_free(s) ;
   free(s) ;
}

int main()
{

EC_KEY *key1;

if(NULL == (key1 = EC_KEY_new_by_curve_name(NID_sect113r1)))
handleErrors();

if(1 != EC_KEY_generate_key(key1)) handleErrors();

BIGNUM *prv1 = EC_KEY_get0_private_key(key1);
 const EC_POINT *pub1  = EC_KEY_get0_public_key(key1);
myPrint(prv1,"\n Private 1:::");


EC_KEY *key2;

if(NULL == (key2 = EC_KEY_new_by_curve_name(NID_sect113r1)))
handleErrors();

if(1 != EC_KEY_generate_key(key2)) handleErrors();

BIGNUM *prv2 = EC_KEY_get0_private_key(key2);
 const EC_POINT *pub2  = EC_KEY_get0_public_key(key2);
myPrint(prv2,"\n Private 2:::");



return 0;

}

Reply via email to