man-pages/man7/evp.7ssl.html
2021-03-31 01:06:50 +01:00

163 lines
7.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of EVP</TITLE>
</HEAD><BODY>
<H1>EVP</H1>
Section: OpenSSL (7SSL)<BR>Updated: 2021-03-22<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
evp - high-level cryptographic functions
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
#include &lt;<A HREF="file:///usr/include/openssl/evp.h">openssl/evp.h</A>&gt;
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The <FONT SIZE="-1">EVP</FONT> library provides a high-level interface to cryptographic
functions.
<P>
The <B>EVP_Seal</B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I> and <B>EVP_Open</B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I>
functions provide public key encryption and decryption to implement digital ``envelopes''.
<P>
The <B>EVP_DigestSign</B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I> and
<B>EVP_DigestVerify</B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I> functions implement
digital signatures and Message Authentication Codes (MACs). Also see the older
<B>EVP_Sign</B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I> and <B>EVP_Verify</B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I>
functions.
<P>
Symmetric encryption is available with the <B>EVP_Encrypt</B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I>
functions. The <B>EVP_Digest</B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I> functions provide message digests.
<P>
The <B></B><FONT SIZE="-1"><B>EVP_PKEY</B></FONT><B></B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I> functions provide a high level interface to
asymmetric algorithms. To create a new <FONT SIZE="-1">EVP_PKEY</FONT> see
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_new">EVP_PKEY_new</A></B>(3). EVP_PKEYs can be associated
with a private key of a particular algorithm by using the functions
described on the <B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_set1_RSA">EVP_PKEY_set1_RSA</A></B>(3) page, or
new keys can be generated using <B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_keygen">EVP_PKEY_keygen</A></B>(3).
EVP_PKEYs can be compared using <B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_cmp">EVP_PKEY_cmp</A></B>(3), or printed using
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_print_private">EVP_PKEY_print_private</A></B>(3).
<P>
The <FONT SIZE="-1">EVP_PKEY</FONT> functions support the full range of asymmetric algorithm operations:
<DL COMPACT>
<DT id="1">For key agreement see <B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_derive">EVP_PKEY_derive</A></B>(3)<DD>
<DT id="2">For signing and verifying see <B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_sign">EVP_PKEY_sign</A></B>(3), <B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_verify">EVP_PKEY_verify</A></B>(3) and <B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_verify_recover">EVP_PKEY_verify_recover</A></B>(3). However, note that these functions do not perform a digest of the data to be signed. Therefore normally you would use the <B><A HREF="/cgi-bin/man/man2html?3+EVP_DigestSignInit">EVP_DigestSignInit</A></B>(3) functions for this purpose.<DD>
<DT id="3">For encryption and decryption see <B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_encrypt">EVP_PKEY_encrypt</A></B>(3) and <B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_decrypt">EVP_PKEY_decrypt</A></B>(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 &quot;digital envelope&quot; using the <B><A HREF="/cgi-bin/man/man2html?3+EVP_SealInit">EVP_SealInit</A></B>(3) and <B><A HREF="/cgi-bin/man/man2html?3+EVP_OpenInit">EVP_OpenInit</A></B>(3) functions.<DD>
</DL>
<P>
The <B><A HREF="/cgi-bin/man/man2html?3+EVP_BytesToKey">EVP_BytesToKey</A></B>(3) function provides some limited support for password
based encryption. Careful selection of the parameters will provide a PKCS#5 <FONT SIZE="-1">PBKDF1</FONT> compatible
implementation. However, new applications should not typically use this (preferring, for example,
<FONT SIZE="-1">PBKDF2</FONT> from PCKS#5).
<P>
The <B>EVP_Encode</B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I> and
<B>EVP_Decode</B><I></I><FONT SIZE="-1"><I>XXX</I></FONT><I></I> functions implement base 64 encoding
and decoding.
<P>
All the symmetric algorithms (ciphers), digests and asymmetric algorithms
(public key algorithms) can be replaced by <FONT SIZE="-1">ENGINE</FONT> modules providing alternative
implementations. If <FONT SIZE="-1">ENGINE</FONT> implementations of ciphers or digests are registered
as defaults, then the various <FONT SIZE="-1">EVP</FONT> functions will automatically use those
implementations automatically in preference to built in software
implementations. For more information, consult the <B><A HREF="/cgi-bin/man/man2html?3+engine">engine</A></B>(3) man page.
<P>
Although low level algorithm specific functions exist for many algorithms
their use is discouraged. They cannot be used with an <FONT SIZE="-1">ENGINE</FONT> and <FONT SIZE="-1">ENGINE</FONT>
versions of new algorithms cannot be accessed using the low level functions.
Also makes code harder to adapt to new algorithms and some options are not
cleanly supported at the low level and some operations are more efficient
using the high level interface.
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+EVP_DigestInit">EVP_DigestInit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_EncryptInit">EVP_EncryptInit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_OpenInit">EVP_OpenInit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_SealInit">EVP_SealInit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_DigestSignInit">EVP_DigestSignInit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_SignInit">EVP_SignInit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_VerifyInit">EVP_VerifyInit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_EncodeInit">EVP_EncodeInit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_new">EVP_PKEY_new</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_set1_RSA">EVP_PKEY_set1_RSA</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_keygen">EVP_PKEY_keygen</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_print_private">EVP_PKEY_print_private</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_decrypt">EVP_PKEY_decrypt</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_encrypt">EVP_PKEY_encrypt</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_sign">EVP_PKEY_sign</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_verify">EVP_PKEY_verify</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_verify_recover">EVP_PKEY_verify_recover</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_derive">EVP_PKEY_derive</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_BytesToKey">EVP_BytesToKey</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+ENGINE_by_id">ENGINE_by_id</A></B>(3)
<A NAME="lbAF">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
<P>
Licensed under the OpenSSL license (the ``License''). You may not use
this file except in compliance with the License. You can obtain a copy
in the file <FONT SIZE="-1">LICENSE</FONT> in the source distribution or at
&lt;<A HREF="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</A>&gt;.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="7"><A HREF="#lbAE">SEE ALSO</A><DD>
<DT id="8"><A HREF="#lbAF">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:08 GMT, March 31, 2021
</BODY>
</HTML>