evp.pod 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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_fromdata(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_eq(3)>, or printed using
  25. L<EVP_PKEY_print_private(3)>. L<EVP_PKEY_todata(3)> can be used to convert a
  26. key back into an L<OSSL_PARAM(3)> array.
  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<XXX>|EVP_EncodeInit(3)> and
  48. L<B<EVP_Decode>I<XXX>|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 ENGINE 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_fromdata(3)>,
  73. L<EVP_PKEY_todata(3)>,
  74. L<EVP_PKEY_keygen(3)>,
  75. L<EVP_PKEY_print_private(3)>,
  76. L<EVP_PKEY_decrypt(3)>,
  77. L<EVP_PKEY_encrypt(3)>,
  78. L<EVP_PKEY_sign(3)>,
  79. L<EVP_PKEY_verify(3)>,
  80. L<EVP_PKEY_verify_recover(3)>,
  81. L<EVP_PKEY_derive(3)>,
  82. L<EVP_BytesToKey(3)>,
  83. L<ENGINE_by_id(3)>
  84. =head1 COPYRIGHT
  85. Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
  86. Licensed under the Apache License 2.0 (the "License"). You may not use
  87. this file except in compliance with the License. You can obtain a copy
  88. in the file LICENSE in the source distribution or at
  89. L<https://www.openssl.org/source/license.html>.
  90. =cut