EVP_OPENINIT(3ossl)
π EVP_OPENINIT(3ossl) β bestie, it's the OpenSSL envelope decryption page
okay so like, welcome to EVP_OpenInit, EVP_OpenUpdate, and EVP_OpenFinal π this is the OpenSSL manual, page 3ossl, and we're talking EVP envelope decryption. yes, the other half of the envelope story. the receiving end. the "open the letter" part. π
β¨ NAME β¨
EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal β EVP envelope decryption π
β¨ SYNOPSIS β¨
#include <openssl/evp.h>
int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek,
int ekl, unsigned char *iv, EVP_PKEY *priv);
int EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, unsigned char *in, int inl);
int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
πΈ DESCRIPTION πΈ
So the EVP envelope routines are a high-level interface to envelope decryption π«Ά what they do is: they decrypt a public-key-encrypted symmetric key, and then use that key to decrypt the actual data. it's giving "unlock the lockbox, then read the letter." iconic behavior honestly π
EVP_OpenInit()β initializes a cipher contextctxfor decryption with ciphertype. it decrypts the encrypted symmetric key of lengtheklbytes passed in theekparameter, using the private keypriv. the IV gets supplied in theivparameter. ποΈEVP_OpenUpdate()andEVP_OpenFinal()β these two have exactly the same properties as theEVP_DecryptUpdate()andEVP_DecryptFinal()routines, as documented on theEVP_EncryptInit(3)manual page. like, literally the same energy, just open-flavored. β¨
π¦ NOTES π¦
ngl there's some real ones here, pay attention bestie:
- It is possible to call
EVP_OpenInit()twice, in the same way asEVP_DecryptInit(). The first call should haveprivset toNULL, and (after setting any cipher parameters) it should be called again withtypeset toNULL. yes that's a two-step, and yes it's on purpose π - If the cipher passed in the
typeparameter is a variable length cipher, then the key length will be set to the value of the recovered key length. If the cipher is a fixed length cipher, then the recovered key length must match the fixed cipher length. no cap, that mismatch is not gonna fly π
π RETURN VALUES π
EVP_OpenInit()β returns0on error, or a non zero integer (actually the recovered secret key size) if successful. so a truthy return is your green flag π«ΆEVP_OpenUpdate()β returns1for success or0for failure.EVP_OpenFinal()β returns0if the decrypt failed or1for success. (yes, final is the one that flips the meaning on you, stay woke π)
π SEE ALSO π
evp(7), RAND_bytes(3), EVP_EncryptInit(3), EVP_SealInit(3)
π COPYRIGHT π
Copyright 2000-2020 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>.
and that's the whole page bestie π mwah π
OpenSSL 3.5.9 Β· 2026-09-29 Β· EVP_OPENINIT(3ossl) β slay, go decrypt something, and remember: the envelope is not gonna open itself βπ§ββοΈ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms