Fix: PEM_read_bio_PrivateKey with no-ui / no-stdio
[openssl.git] / doc / crypto / dh.pod
1 =pod
2
3 =head1 NAME
4
5 dh - Diffie-Hellman key agreement
6
7 =head1 SYNOPSIS
8
9  #include <openssl/dh.h>
10  #include <openssl/engine.h>
11
12  DH *   DH_new(void);
13  void   DH_free(DH *dh);
14
15  DH *   DH_generate_parameters(int prime_len, int generator,
16                 void (*callback)(int, int, void *), void *cb_arg);
17  int    DH_check(const DH *dh, int *codes);
18
19  int    DH_generate_key(DH *dh);
20  int    DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh);
21
22  void DH_set_default_method(const DH_METHOD *meth);
23  const DH_METHOD *DH_get_default_method(void);
24  int DH_set_method(DH *dh, const DH_METHOD *meth);
25  DH *DH_new_method(ENGINE *engine);
26  const DH_METHOD *DH_OpenSSL(void);
27
28  DH *   d2i_DHparams(DH **a, unsigned char **pp, long length);
29  int    i2d_DHparams(const DH *a, unsigned char **pp);
30
31  int    DHparams_print_fp(FILE *fp, const DH *x);
32  int    DHparams_print(BIO *bp, const DH *x);
33
34 =head1 DESCRIPTION
35
36 These functions implement the Diffie-Hellman key agreement protocol.
37 The generation of shared DH parameters is described in
38 L<DH_generate_parameters(3)>; L<DH_generate_key(3)> describes how
39 to perform a key agreement.
40
41 The B<DH> structure consists of several BIGNUM components. The prime B<p>, the
42 generate B<g>, the Private key B<priv_key> and the public key B<pub_key>.
43 Optionally there may also be an additional parameter B<q>.
44
45 Note that DH keys may use non-standard B<DH_METHOD> implementations,
46 either directly or by the use of B<ENGINE> modules. In some cases (eg. an
47 ENGINE providing support for hardware-embedded keys), these BIGNUM values
48 will not be used by the implementation or may be used for alternative data
49 storage.
50
51 =head1 SEE ALSO
52
53 L<dhparam(1)>, L<bn(3)>, L<dsa(3)>, L<err(3)>,
54 L<rand(3)>, L<rsa(3)>, L<engine(3)>,
55 L<DH_set_method(3)>, L<DH_new(3)>,
56 L<DH_get_ex_new_index(3)>,
57 L<DH_generate_parameters(3)>,
58 L<DH_compute_key(3)>, L<DH_get0_pqg(3)>, L<DH_meth_new(3)>, L<d2i_DHparams(3)>,
59 L<RSA_print(3)>
60
61 =head1 COPYRIGHT
62
63 Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
64
65 Licensed under the OpenSSL license (the "License").  You may not use
66 this file except in compliance with the License.  You can obtain a copy
67 in the file LICENSE in the source distribution or at
68 L<https://www.openssl.org/source/license.html>.
69
70 =cut