aboutsummaryrefslogtreecommitdiffstats
path: root/doc/crypto/dh.pod
blob: 13448e947b48ee210ed6f8237c9fd01969dde5db (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
=pod

=head1 NAME

dh - Diffie-Hellman key agreement

=head1 SYNOPSIS

 #include <openssl/dh.h>
 #include <openssl/engine.h>

 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);
 int	DH_check(const DH *dh, int *codes);

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

 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);
 DH *DH_new_method(ENGINE *engine);
 const DH_METHOD *DH_OpenSSL(void);

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

 int	DHparams_print_fp(FILE *fp, const DH *x);
 int	DHparams_print(BIO *bp, const 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. The prime B<p>, the
generate B<g>, the Private key B<priv_key> and the public key B<pub_key>.
Optionally there may also be an additional parameter B<q>.

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.

=head1 SEE ALSO

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<DH_get0_pqg(3)>, L<DH_meth_new(3)>, L<d2i_DHparams(3)>,
L<RSA_print(3)> 

=cut

=head1 COPYRIGHT

Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the OpenSSL license (the "License").  You may not use
this file except in compliance with the License.  You can obtain a copy
in the file LICENSE in the source distribution or at
L<https://www.openssl.org/source/license.html>.

=cut