evp.pod 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. =pod
  2. =for comment openssl_manual_section:7
  3. =head1 NAME
  4. evp - high-level cryptographic functions
  5. =head1 SYNOPSIS
  6. #include <openssl/evp.h>
  7. =head1 DESCRIPTION
  8. The EVP library provides a high-level interface to cryptographic
  9. functions.
  10. L<B<EVP_Seal>I<...>|EVP_SealInit(3)> and L<B<EVP_Open>I<...>|EVP_OpenInit(3)>
  11. provide public key encryption and decryption to implement digital "envelopes".
  12. The L<B<EVP_DigestSign>I<...>|EVP_DigestSignInit(3)> and
  13. L<B<EVP_DigestVerify>I<...>|EVP_DigestVerifyInit(3)> functions implement
  14. digital signatures and Message Authentication Codes (MACs). Also see the older
  15. L<B<EVP_Sign>I<...>|EVP_SignInit(3)> and L<B<EVP_Verify>I<...>|EVP_VerifyInit(3)>
  16. functions.
  17. Symmetric encryption is available with the L<B<EVP_Encrypt>I<...>|EVP_EncryptInit(3)>
  18. functions. The L<B<EVP_Digest>I<...>|EVP_DigestInit(3)> functions provide message digests.
  19. The B<EVP_PKEY>I<...> functions provide a high level interface to
  20. asymmetric algorithms. To create a new EVP_PKEY see
  21. L<EVP_PKEY_new(3)>. EVP_PKEYs can be associated
  22. with a private key of a particular algorithm by using the functions
  23. described on the L<EVP_PKEY_set1_RSA(3)> page, or
  24. new keys can be generated using L<EVP_PKEY_keygen(3)>.
  25. EVP_PKEYs can be compared using L<EVP_PKEY_cmp(3)>, or printed using
  26. L<EVP_PKEY_print_private(3)>.
  27. The EVP_PKEY functions support the full range of asymmetric algorithm operations:
  28. =over 4
  29. =item For key agreement see L<EVP_PKEY_derive(3)>
  30. =item For signing and verifying see L<EVP_PKEY_sign(3)>,
  31. L<EVP_PKEY_verify(3)> and L<EVP_PKEY_verify_recover(3)>.
  32. However, note that
  33. these functions do not perform a digest of the data to be signed. Therefore
  34. normally you would use the L<EVP_DigestSignInit(3)>
  35. functions for this purpose.
  36. =item For encryption and decryption see L<EVP_PKEY_encrypt(3)>
  37. and L<EVP_PKEY_decrypt(3)> respectively. However, note that
  38. these functions perform encryption and decryption only. As public key
  39. encryption is an expensive operation, normally you would wrap
  40. an encrypted message in a "digital envelope" using the L<EVP_SealInit(3)> and
  41. L<EVP_OpenInit(3)> functions.
  42. =back
  43. The L<EVP_BytesToKey(3)> function provides some limited support for password
  44. based encryption. Careful selection of the parameters will provide a PKCS#5 PBKDF1 compatible
  45. implementation. However, new applications should not typically use this (preferring, for example,
  46. PBKDF2 from PCKS#5).
  47. The L<B<EVP_Encode>I<...>|EVP_EncodeInit(3)> and
  48. L<B<EVP_Decode>I<...>|EVP_EncodeInit(3)> functions implement base 64 encoding
  49. and decoding.
  50. All the symmetric algorithms (ciphers), digests and asymmetric algorithms
  51. (public key algorithms) can be replaced by L<engine(3)> modules providing alternative
  52. implementations. If ENGINE implementations of ciphers or digests are registered
  53. as defaults, then the various EVP functions will automatically use those
  54. implementations automatically in preference to built in software
  55. implementations. For more information, consult the engine(3) man page.
  56. Although low level algorithm specific functions exist for many algorithms
  57. their use is discouraged. They cannot be used with an ENGINE and ENGINE
  58. versions of new algorithms cannot be accessed using the low level functions.
  59. Also makes code harder to adapt to new algorithms and some options are not
  60. cleanly supported at the low level and some operations are more efficient
  61. using the high level interface.
  62. =head1 SEE ALSO
  63. L<EVP_DigestInit(3)>,
  64. L<EVP_EncryptInit(3)>,
  65. L<EVP_OpenInit(3)>,
  66. L<EVP_SealInit(3)>,
  67. L<EVP_DigestSignInit(3)>,
  68. L<EVP_SignInit(3)>,
  69. L<EVP_VerifyInit(3)>,
  70. L<EVP_EncodeInit(3)>,
  71. L<EVP_PKEY_new(3)>,
  72. L<EVP_PKEY_set1_RSA(3)>,
  73. L<EVP_PKEY_keygen(3)>,
  74. L<EVP_PKEY_print_private(3)>,
  75. L<EVP_PKEY_decrypt(3)>,
  76. L<EVP_PKEY_encrypt(3)>,
  77. L<EVP_PKEY_sign(3)>,
  78. L<EVP_PKEY_verify(3)>,
  79. L<EVP_PKEY_verify_recover(3)>,
  80. L<EVP_PKEY_derive(3)>,
  81. L<EVP_BytesToKey(3)>,
  82. L<engine(3)>
  83. =head1 COPYRIGHT
  84. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  85. Licensed under the OpenSSL license (the "License"). You may not use
  86. this file except in compliance with the License. You can obtain a copy
  87. in the file LICENSE in the source distribution or at
  88. L<https://www.openssl.org/source/license.html>.
  89. =cut