EVP(7ossl)
π EVP β like, the high-level cryptographic functions bestie β¨
Okay so this is the EVP(7ossl) page from the OpenSSL fam, and honestly? It's kind of a big deal. Let me put you on.
π«Ά SYNOPSIS
#include <openssl/evp.h>
That's it. That's the whole vibe check. You include this header and suddenly you have access to the entire high-level crypto toolbox. Iconic behavior, honestly.
πΈ DESCRIPTION
So the EVP library? It literally provides a high-level interface to cryptographic functions. Like, it's the main character of the OpenSSL world. Let me walk you through the whole cast π
The EVP_SealXXX and EVP_OpenXXX functions are the envelope girls π β they do public key encryption and decryption to implement digital "envelopes." Cute, right?
The EVP_DigestSignXXX and EVP_DigestVerifyXXX functions are out here implementing digital signatures and Message Authentication Codes (MACs). Also, do yourself a favor and check out the older EVP_SignXXX and EVP_VerifyXXX functions β they're giving legacy but still valid β¨
Symmetric encryption? That's the EVP_EncryptXXX functions. And the EVP_DigestXXX functions provide message digests. Slay.
π The EVP_PKEY situation
The EVP_PKEYXXX functions give you a high-level interface to asymmetric algorithms. To create a new EVP_PKEY, go see EVP_PKEY_new(3). EVP_PKEYs can be associated with a private key of a particular algorithm by using the functions described on the EVP_PKEY_fromdata(3) page, or you can generate brand new keys using EVP_PKEY_keygen(3). You can compare EVP_PKEYs using EVP_PKEY_eq(3), or print them using EVP_PKEY_print_private(3). And EVP_PKEY_todata(3) can be used to convert a key back into an OSSL_PARAM(3) array. Versatile queens only π
The EVP_PKEY functions support the full range of asymmetric algorithm operations, no cap:
- For key agreement β see
EVP_PKEY_derive(3)π€ - For signing and verifying β see
EVP_PKEY_sign(3),EVP_PKEY_verify(3)andEVP_PKEY_verify_recover(3). BUT β οΈ note that these functions do not perform a digest of the data to be signed. So like, normally you would use theEVP_DigestSignInit(3)functions for this purpose instead. Just saying. - For encryption and decryption β see
EVP_PKEY_encrypt(3)andEVP_PKEY_decrypt(3)respectively. BUT again β οΈ these functions perform encryption and decryption only. And since public key encryption is an expensive operation (it's giving high-maintenance), normally you would wrap an encrypted message in a "digital envelope" using theEVP_SealInit(3)andEVP_OpenInit(3)functions. Efficiency queen π
π Password-based encryption, but read the fine print
The EVP_BytesToKey(3) function provides some limited support for password based encryption. Careful selection of the parameters will provide a PKCS#5 PBKDF1 compatible implementation. HOWEVER β and I need you to hear this β new applications should not typically use this (preferring, for example, PBKDF2 from PCKS#5). Like, it's fine for legacy, but don't make it your whole personality, bestie π
π§ Base64 moment
The EVP_EncodeXXX and EVP_DecodeXXX functions implement base64 encoding and decoding. That's it. Short and sweet. We love a concise king π
β¨ ENGINE modules β the plug-in besties
All the symmetric algorithms (ciphers), digests and asymmetric algorithms (public key algorithms) can be replaced by ENGINE modules providing alternative implementations π₯ If ENGINE implementations of ciphers or digests are registered as defaults, then the various EVP functions will automatically use those implementations automatically in preference to built in software implementations. For more information, consult the engine(3) man page. Go read it, I'll wait π«Ά
π A warning about low-level functions
Okay so although low-level algorithm specific functions exist for many algorithms, bestie, their use is discouraged. Here's why:
- They cannot be used with an ENGINE β
- ENGINE versions of new algorithms cannot be accessed using the low-level functions β
- It 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
Basically the low-level ones are giving "I peaked in high school" and the high-level interface is thriving. Choose wisely π
π SEE ALSO
Like, go read these next, they're all gonna eat:
EVP_DigestInit(3), EVP_EncryptInit(3), EVP_OpenInit(3), EVP_SealInit(3), EVP_DigestSignInit(3), EVP_SignInit(3), EVP_VerifyInit(3), EVP_EncodeInit(3), EVP_PKEY_new(3), EVP_PKEY_fromdata(3), EVP_PKEY_todata(3), EVP_PKEY_keygen(3), EVP_PKEY_print_private(3), EVP_PKEY_decrypt(3), EVP_PKEY_encrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3), EVP_BytesToKey(3), ENGINE_by_id(3)
π COPYRIGHT
Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
That's the whole page, bestie β you're now officially fluent in EVP β¨ This was version 3.5.0, dated 2026-09-25, and that's the EVP(7ossl) manual page, signing off. Go forth and encrypt responsibly ππ¦
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms