dh(3) OpenSL dh(3)
NAME
dh - Diffie-Hellman key agreement
SYNOPSIS
#include
#include
DH * DHnew(void);
void DHfree(DH *dh);
int DHsize(const DH *dh);
DH * DHgenerateparameters(int primelen, int generator,
void (*callback)(int, int, void *), void *cbarg);
int DHcheck(const DH *dh, int *codes);
int DHgeneratekey(DH *dh);
int DHcomputekey(unsigned char *key, BIGNUM *pubkey, DH *dh);
void DHsetdefaultmethod(const DHMETHOD *meth);
const DHMETHOD *DHgetdefaultmethod(void);
int DHsetmethod(DH *dh, const DHMETHOD *meth);
DH *DHnewmethod(ENGINE *engine);
const DHMETHOD *DHOpenSL(void);
int DHgetexnewindex(long argl, char *argp, int (*newfunc)(),
int (*dupfunc)(), void (*freefunc)());
int DHsetexdata(DH *d, int idx, char *arg);
char *DHgetexdata(DH *d, int idx);
DH * d2iDHparams(DH **a, unsigned char **pp, long length);
int i2dDHparams(const DH *a, unsigned char **pp);
int DHparamsprintfp(FILE *fp, const DH *x);
int DHparamsprint(BIO *bp, const DH *x);
DESCRIPTION
These functions implement the Diffie-Hellman key agreement protocol.
The generation of shared DH parameters is described in DHgener-
ateparameters(3); DHgeneratekey(3) describes how to perform a key
agreement.
The DH structure consists of several BIGNUM components.
struct
{
BIGNUM *p; / prime number (shared)
BIGNUM *g; / generator of Zp (shared)
BIGNUM *privkey; / private DH value x
BIGNUM *pubkey; / public DH value g^x
/ ...
};
DH
Note that DH keys may use non-standard DHMETHOD implementations,
either directly or by the use of ENGINE modules. In some cases (eg. an
ENGINE providing support for hardware-embedded keys), these BIGNUM val-
ues will not be used by the implementation or may be used for alterna-
tive data storage. For this reason, applications should generally avoid
using DH structure elements directly and instead use API functions to
query or modify keys.
SEE ALSO
dhparam(1), bn(3), dsa(3), err(3), rand(3), rsa(3), engine(3),
DHsetmethod(3), DHnew(3), DHgetexnewindex(3), DHgenerateparam-
eters(3), DHcomputekey(3), d2iDHparams(3), RSAprint(3)
0.9.7l 2002-08-05 dh(3)
|