evp.7ossl 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "EVP 7ossl"
  58. .TH EVP 7ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. evp \- high\-level cryptographic functions
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. .Vb 1
  68. \& #include <openssl/evp.h>
  69. .Ve
  70. .SH DESCRIPTION
  71. .IX Header "DESCRIPTION"
  72. The EVP library provides a high-level interface to cryptographic
  73. functions.
  74. .PP
  75. The \fBEVP_Seal\fR\fIXXX\fR and \fBEVP_Open\fR\fIXXX\fR
  76. functions provide public key encryption and decryption to implement digital "envelopes".
  77. .PP
  78. The \fBEVP_DigestSign\fR\fIXXX\fR and
  79. \&\fBEVP_DigestVerify\fR\fIXXX\fR functions implement
  80. digital signatures and Message Authentication Codes (MACs). Also see the older
  81. \&\fBEVP_Sign\fR\fIXXX\fR and \fBEVP_Verify\fR\fIXXX\fR
  82. functions.
  83. .PP
  84. Symmetric encryption is available with the \fBEVP_Encrypt\fR\fIXXX\fR
  85. functions. The \fBEVP_Digest\fR\fIXXX\fR functions provide message digests.
  86. .PP
  87. The \fBEVP_PKEY\fR\fIXXX\fR functions provide a high-level interface to
  88. asymmetric algorithms. To create a new EVP_PKEY see
  89. \&\fBEVP_PKEY_new\fR\|(3). EVP_PKEYs can be associated
  90. with a private key of a particular algorithm by using the functions
  91. described on the \fBEVP_PKEY_fromdata\fR\|(3) page, or
  92. new keys can be generated using \fBEVP_PKEY_keygen\fR\|(3).
  93. EVP_PKEYs can be compared using \fBEVP_PKEY_eq\fR\|(3), or printed using
  94. \&\fBEVP_PKEY_print_private\fR\|(3). \fBEVP_PKEY_todata\fR\|(3) can be used to convert a
  95. key back into an \fBOSSL_PARAM\fR\|(3) array.
  96. .PP
  97. The EVP_PKEY functions support the full range of asymmetric algorithm operations:
  98. .IP "For key agreement see \fBEVP_PKEY_derive\fR\|(3)" 4
  99. .IX Item "For key agreement see EVP_PKEY_derive"
  100. .PD 0
  101. .IP "For signing and verifying see \fBEVP_PKEY_sign\fR\|(3), \fBEVP_PKEY_verify\fR\|(3) and \fBEVP_PKEY_verify_recover\fR\|(3). However, note that these functions do not perform a digest of the data to be signed. Therefore, normally you would use the \fBEVP_DigestSignInit\fR\|(3) functions for this purpose." 4
  102. .IX Item "For signing and verifying see EVP_PKEY_sign, EVP_PKEY_verify and EVP_PKEY_verify_recover. However, note that these functions do not perform a digest of the data to be signed. Therefore, normally you would use the EVP_DigestSignInit functions for this purpose."
  103. .IP "For encryption and decryption see \fBEVP_PKEY_encrypt\fR\|(3) and \fBEVP_PKEY_decrypt\fR\|(3) respectively. However, note that these functions perform encryption and decryption only. As public key encryption is an expensive operation, normally you would wrap an encrypted message in a ""digital envelope"" using the \fBEVP_SealInit\fR\|(3) and \fBEVP_OpenInit\fR\|(3) functions." 4
  104. .IX Item "For encryption and decryption see EVP_PKEY_encrypt and EVP_PKEY_decrypt respectively. However, note that these functions perform encryption and decryption only. As public key encryption is an expensive operation, normally you would wrap an encrypted message in a ""digital envelope"" using the EVP_SealInit and EVP_OpenInit functions."
  105. .PD
  106. .PP
  107. The \fBEVP_BytesToKey\fR\|(3) function provides some limited support for password
  108. based encryption. Careful selection of the parameters will provide a PKCS#5 PBKDF1 compatible
  109. implementation. However, new applications should not typically use this (preferring, for example,
  110. PBKDF2 from PCKS#5).
  111. .PP
  112. The \fBEVP_Encode\fR\fIXXX\fR and
  113. \&\fBEVP_Decode\fR\fIXXX\fR functions implement base64 encoding
  114. and decoding.
  115. .PP
  116. All the symmetric algorithms (ciphers), digests and asymmetric algorithms
  117. (public key algorithms) can be replaced by ENGINE modules providing alternative
  118. implementations. If ENGINE implementations of ciphers or digests are registered
  119. as defaults, then the various EVP functions will automatically use those
  120. implementations automatically in preference to built in software
  121. implementations. For more information, consult the \fBengine\fR\|(3) man page.
  122. .PP
  123. Although low-level algorithm specific functions exist for many algorithms
  124. their use is discouraged. They cannot be used with an ENGINE and ENGINE
  125. versions of new algorithms cannot be accessed using the low-level functions.
  126. Also makes code harder to adapt to new algorithms and some options are not
  127. cleanly supported at the low-level and some operations are more efficient
  128. using the high-level interface.
  129. .SH "SEE ALSO"
  130. .IX Header "SEE ALSO"
  131. \&\fBEVP_DigestInit\fR\|(3),
  132. \&\fBEVP_EncryptInit\fR\|(3),
  133. \&\fBEVP_OpenInit\fR\|(3),
  134. \&\fBEVP_SealInit\fR\|(3),
  135. \&\fBEVP_DigestSignInit\fR\|(3),
  136. \&\fBEVP_SignInit\fR\|(3),
  137. \&\fBEVP_VerifyInit\fR\|(3),
  138. \&\fBEVP_EncodeInit\fR\|(3),
  139. \&\fBEVP_PKEY_new\fR\|(3),
  140. \&\fBEVP_PKEY_fromdata\fR\|(3),
  141. \&\fBEVP_PKEY_todata\fR\|(3),
  142. \&\fBEVP_PKEY_keygen\fR\|(3),
  143. \&\fBEVP_PKEY_print_private\fR\|(3),
  144. \&\fBEVP_PKEY_decrypt\fR\|(3),
  145. \&\fBEVP_PKEY_encrypt\fR\|(3),
  146. \&\fBEVP_PKEY_sign\fR\|(3),
  147. \&\fBEVP_PKEY_verify\fR\|(3),
  148. \&\fBEVP_PKEY_verify_recover\fR\|(3),
  149. \&\fBEVP_PKEY_derive\fR\|(3),
  150. \&\fBEVP_BytesToKey\fR\|(3),
  151. \&\fBENGINE_by_id\fR\|(3)
  152. .SH COPYRIGHT
  153. .IX Header "COPYRIGHT"
  154. Copyright 2000\-2024 The OpenSSL Project Authors. All Rights Reserved.
  155. .PP
  156. Licensed under the Apache License 2.0 (the "License"). You may not use
  157. this file except in compliance with the License. You can obtain a copy
  158. in the file LICENSE in the source distribution or at
  159. <https://www.openssl.org/source/license.html>.