Do you mean something like that: DH* dh; dh = DH_new();
RAND_bytes(random_bytes, 256/8); dh->priv_key = BN_bin2bn(random_bytes, 256/8, NULL); DH_generate_key(dh); In this way, is dh->pub_key serialized ? 2011/3/25 Frank Morgner <frankmorg...@gmx.de> > > Hi! > > > How to serialized dh->pub_key ? I know that i2d_DHparams(const_dh, &dhbuf); > > serialize dh structure pointed by const_dh but I did not find a function to > > serialize just dh->pub_key > > Use BN_bin2bn. > > Greets, Frank.