I am trying to implement diffie hellman Key exchange by filling a DH structure 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
while filling the private key with a random number Here it requires a BIGNUM is it safe to use BN_rand directly i am not sure which api has to be used to seed it. Earlier i tried with Rand_Bytes which i seeded with /dev/random file ( using RAND_load_file).
is there way to seed BN_rand.
or is there way to convert the unsigned char* buffer returned by Rand_Bytes to a BIGNUM .
Aucun commentaire:
Enregistrer un commentaire