evp.pod 4.1 KB

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