NAME
DHgeneratekey, DHcomputekey - perform Diffie-Hellman key exchange
SYNOPSIS
#include
int DHgeneratekey(DH *dh); int DHcomputekey(unsigned char *key, BIGNUM *pubkey, DH *dh);DESCRIPTION
DHgeneratekey() performs the first step of a Diffie-Hellman key
exchange by generating private and public DH values. By calling DHcomputekey(), these are combined with the other party's public value to compute the shared key.DHgeneratekey() expects ddhh to contain the shared parameters ddhh->>pp and
ddhh->>gg. It generates a random private DH value unless ddhh->>pprriivvkkeeyy is
already set, and computes the corresponding public value ddhh->>ppuubbkkeeyy,
which can then be published. DHcomputekey() computes the shared secret from the private DH value in ddhh and the other party's public value in ppuubbkkeeyy and stores it in kkeeyy. kkeeyy must point to DDHHssiizzee((ddhh)) bytes of memory.RETURN VALUES
DHgeneratekey() returns 1 on success, 0 otherwise.DHcomputekey() returns the size of the shared secret on success, -1
on error. The error codes can be obtained by ERRgeterror(3).SEE ALSO
dh(3), ERRgeterror(3), rand(3), DHsize(3) HISTORY DHgeneratekey() and DHcomputekey() are available in all versions of SSLeay and OpenSSL.0.9.7l 2002-09-25 DHgeneratekey(3)