2
0

dh.pod 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. =pod
  2. =head1 NAME
  3. dh - Diffie-Hellman key agreement
  4. =head1 SYNOPSIS
  5. #include <openssl/dh.h>
  6. #include <openssl/engine.h>
  7. DH * DH_new(void);
  8. void DH_free(DH *dh);
  9. int DH_size(const DH *dh);
  10. DH * DH_generate_parameters(int prime_len, int generator,
  11. void (*callback)(int, int, void *), void *cb_arg);
  12. int DH_check(const DH *dh, int *codes);
  13. int DH_generate_key(DH *dh);
  14. int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh);
  15. void DH_set_default_method(const DH_METHOD *meth);
  16. const DH_METHOD *DH_get_default_method(void);
  17. int DH_set_method(DH *dh, const DH_METHOD *meth);
  18. DH *DH_new_method(ENGINE *engine);
  19. const DH_METHOD *DH_OpenSSL(void);
  20. int DH_get_ex_new_index(long argl, char *argp, int (*new_func)(),
  21. int (*dup_func)(), void (*free_func)());
  22. int DH_set_ex_data(DH *d, int idx, char *arg);
  23. char *DH_get_ex_data(DH *d, int idx);
  24. DH * d2i_DHparams(DH **a, unsigned char **pp, long length);
  25. int i2d_DHparams(const DH *a, unsigned char **pp);
  26. int DHparams_print_fp(FILE *fp, const DH *x);
  27. int DHparams_print(BIO *bp, const DH *x);
  28. =head1 DESCRIPTION
  29. These functions implement the Diffie-Hellman key agreement protocol.
  30. The generation of shared DH parameters is described in
  31. L<DH_generate_parameters(3)|DH_generate_parameters(3)>; L<DH_generate_key(3)|DH_generate_key(3)> describes how
  32. to perform a key agreement.
  33. The B<DH> structure consists of several BIGNUM components.
  34. struct
  35. {
  36. BIGNUM *p; // prime number (shared)
  37. BIGNUM *g; // generator of Z_p (shared)
  38. BIGNUM *priv_key; // private DH value x
  39. BIGNUM *pub_key; // public DH value g^x
  40. // ...
  41. };
  42. DH
  43. Note that DH keys may use non-standard B<DH_METHOD> implementations,
  44. either directly or by the use of B<ENGINE> modules. In some cases (eg. an
  45. ENGINE providing support for hardware-embedded keys), these BIGNUM values
  46. will not be used by the implementation or may be used for alternative data
  47. storage. For this reason, applications should generally avoid using DH
  48. structure elements directly and instead use API functions to query or
  49. modify keys.
  50. =head1 SEE ALSO
  51. L<dhparam(1)|dhparam(1)>, L<bn(3)|bn(3)>, L<dsa(3)|dsa(3)>, L<err(3)|err(3)>,
  52. L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, L<engine(3)|engine(3)>,
  53. L<DH_set_method(3)|DH_set_method(3)>, L<DH_new(3)|DH_new(3)>,
  54. L<DH_get_ex_new_index(3)|DH_get_ex_new_index(3)>,
  55. L<DH_generate_parameters(3)|DH_generate_parameters(3)>,
  56. L<DH_compute_key(3)|DH_compute_key(3)>, L<d2i_DHparams(3)|d2i_DHparams(3)>,
  57. L<RSA_print(3)|RSA_print(3)>
  58. =cut