I do not understand what you mean. 1) I tried to print data's size returned by i2d_DHparams(const_dh, &dhbuf); without computing private nor public key. I have got 138 bytes. Then I remade the same operation but I had computed private and public key using DH_generate_key(dh); and I have still got 138 bytes ...it seems to be odd for me, because I think dh's size must be greater after computing keys.
2) I tried the following check before and after computing keys : if (dh->priv_key == NULL) printf("\n1)dh->priv_key is NULL\n"); else printf("\n1)dh->priv_key is not NULL\n"); Before computing key, I have got priv_key is NULL. After computing, priv_key is not NULL I 'm wondering what happens... could you tell me more about bit counting ? I do not understand "The private and public keys should be similar in size to p. " Thanks for your help. 2011/3/23 Mike Mohr <akih...@gmail.com> > Try checking the bit count of the structure members. The private and public > keys should be similar in size to p. > On Mar 23, 2011 10:27 AM, "ikuzar" <razuk...@gmail.com> wrote: > > Hello, > > I 'd like to know how to verify that DH private and public key have been > > generated ? > > In my DH struct, p and g had been generated with commands line ( openssl > > dhparam... ) > > > > struct > > { > > BIGNUM *p; // prime number (shared) > > BIGNUM *g; // generator of Z_p (shared) > > BIGNUM *priv_key; // private DH value x > > BIGNUM *pub_key; // public DH value g^x > > // ... > > }; > > DH > > > > > > Priv_key and pub_key are generated later with DH_generate_key(dh). > > > > I would like verify if DH_generate_key( ) has generated the priv_key ( an > > human proof, example by using DHparams_print_fp(fp, dh ); ) I used this > > function but it did not print private key into file pointed by fp. > > > > Thanks for your help. >