dh.pod 1.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
=pod

=head1 NAME

dh - Diffie-Hellman key agreement

=head1 SYNOPSIS

 #include <openssl/dh.h>

 void DH_set_default_method(DH_METHOD *meth);
 DH_METHOD *DH_get_default_method(void);
 DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth);
 DH *DH_new_method(DH_METHOD *meth);
 DH_METHOD *DH_OpenSSL(void);

 DH *	DH_new(void);
 void	DH_free(DH *dh);

 int	DH_size(DH *dh);

 int DH_get_ex_new_index(long argl, char *argp, int (*new_func)(),
	     int (*dup_func)(), void (*free_func)());
 int DH_set_ex_data(DH *d, int idx, char *arg);
 char *DH_get_ex_data(DH *d, int idx);

 DH *	DH_generate_parameters(int prime_len, int generator,
		void (*callback)(int, int, void *), void *cb_arg);
 int	DH_check(DH *dh, int *codes);

 int	DH_generate_key(DH *dh);
 int	DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh);

 DH *	d2i_DHparams(DH **a, unsigned char **pp, long length);
 int	i2d_DHparams(DH *a, unsigned char **pp);

 int	DHparams_print_fp(FILE *fp, DH *x);
 int	DHparams_print(BIO *bp, DH *x);

=head1 DESCRIPTION

These functions implement the Diffie-Hellman key agreement protocol.
The generation of shared DH parameters is described in
L<DH_generate_parameters(3)>; L<DH_generate_key(3)> describes how
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
U
Ulf Möller 已提交
55
        // ...
56 57 58 59 60
        };
 DH

=head1 SEE ALSO

U
Ulf Möller 已提交
61
dhparam(1), bn(3), dsa(3), err(3), rand(3), rsa(3), DH_set_method(3),
62 63 64 65
DH_new(3), DH_get_ex_new_index(3), DH_generate_parameters(3),
DH_compute_key(3), d2i_DHparams(3), DHparams_print(3)

=cut