2000-01-23 04:05:23 +08:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
dh - Diffie-Hellman key agreement
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include <openssl/dh.h>
|
2000-10-27 05:07:28 +08:00
|
|
|
#include <openssl/engine.h>
|
2000-01-23 04:05:23 +08:00
|
|
|
|
|
|
|
DH * DH_new(void);
|
|
|
|
void DH_free(DH *dh);
|
|
|
|
|
|
|
|
DH * DH_generate_parameters(int prime_len, int generator,
|
|
|
|
void (*callback)(int, int, void *), void *cb_arg);
|
2002-08-06 00:27:01 +08:00
|
|
|
int DH_check(const DH *dh, int *codes);
|
2000-01-23 04:05:23 +08:00
|
|
|
|
|
|
|
int DH_generate_key(DH *dh);
|
|
|
|
int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh);
|
|
|
|
|
2002-08-06 00:27:01 +08:00
|
|
|
void DH_set_default_method(const DH_METHOD *meth);
|
|
|
|
const DH_METHOD *DH_get_default_method(void);
|
|
|
|
int DH_set_method(DH *dh, const DH_METHOD *meth);
|
2000-10-27 05:07:28 +08:00
|
|
|
DH *DH_new_method(ENGINE *engine);
|
2002-08-06 00:27:01 +08:00
|
|
|
const DH_METHOD *DH_OpenSSL(void);
|
2000-01-28 03:31:26 +08:00
|
|
|
|
2000-01-23 04:05:23 +08:00
|
|
|
DH * d2i_DHparams(DH **a, unsigned char **pp, long length);
|
2002-08-06 00:27:01 +08:00
|
|
|
int i2d_DHparams(const DH *a, unsigned char **pp);
|
2000-01-23 04:05:23 +08:00
|
|
|
|
2002-08-06 00:27:01 +08:00
|
|
|
int DHparams_print_fp(FILE *fp, const DH *x);
|
|
|
|
int DHparams_print(BIO *bp, const DH *x);
|
2000-01-23 04:05:23 +08:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
These functions implement the Diffie-Hellman key agreement protocol.
|
|
|
|
The generation of shared DH parameters is described in
|
2015-08-18 03:21:33 +08:00
|
|
|
L<DH_generate_parameters(3)>; L<DH_generate_key(3)> describes how
|
2000-01-23 04:05:23 +08:00
|
|
|
to perform a key agreement.
|
|
|
|
|
|
|
|
The B<DH> structure consists of several BIGNUM components.
|
|
|
|
|
|
|
|
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
|
2000-01-24 06:06:24 +08:00
|
|
|
// ...
|
2000-01-23 04:05:23 +08:00
|
|
|
};
|
|
|
|
DH
|
|
|
|
|
2002-08-06 00:27:01 +08:00
|
|
|
Note that DH keys may use non-standard B<DH_METHOD> implementations,
|
|
|
|
either directly or by the use of B<ENGINE> modules. In some cases (eg. an
|
|
|
|
ENGINE providing support for hardware-embedded keys), these BIGNUM values
|
|
|
|
will not be used by the implementation or may be used for alternative data
|
|
|
|
storage. For this reason, applications should generally avoid using DH
|
|
|
|
structure elements directly and instead use API functions to query or
|
|
|
|
modify keys.
|
|
|
|
|
2000-01-23 04:05:23 +08:00
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2015-08-18 03:21:33 +08:00
|
|
|
L<dhparam(1)>, L<bn(3)>, L<dsa(3)>, L<err(3)>,
|
|
|
|
L<rand(3)>, L<rsa(3)>, L<engine(3)>,
|
|
|
|
L<DH_set_method(3)>, L<DH_new(3)>,
|
|
|
|
L<DH_get_ex_new_index(3)>,
|
|
|
|
L<DH_generate_parameters(3)>,
|
|
|
|
L<DH_compute_key(3)>, L<d2i_DHparams(3)>,
|
|
|
|
L<RSA_print(3)>
|
2000-01-23 04:05:23 +08:00
|
|
|
|
|
|
|
=cut
|