EVP_OPENINIT(3ossl)
π EVP_OPENINIT π
okay so bestie, this is the OpenSSL page for EVP_OpenInit, EVP_OpenUpdate and EVP_OpenFinal β the whole envelope-decryption friend group. it's giving "open the envelope, get the key, get the tea" π₯
β¨ NAME β¨
EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal β EVP envelope decryption. yes queen, we're opening envelopes π
πΈ 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);
copy these exactly, no cap π«Ά
π¦ DESCRIPTION π¦
the EVP envelope routines are like the high-level, main-character interface to envelope decryption. what they do is: first they decrypt a public key encrypted symmetric key, and then they use that key to decrypt the actual data. it's a two-step slay β¨
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 is supplied in theivparameter. iconic behaviour honestly πEVP_OpenUpdate()andEVP_OpenFinal()β these have exactly the same properties as theEVP_DecryptUpdate()andEVP_DecryptFinal()routines, as documented on theEVP_EncryptInit(3)manual page. literally identical vibe, different name π
π NOTES π
you can call EVP_OpenInit() twice, same way as EVP_DecryptInit(). here's the choreography:
- first call: have
privset toNULL - after setting any cipher parameters
- call it again with
typeset toNULL
and about key lengths, listen up π if the cipher you passed in the type parameter is a variable length cipher, then the key length gets set to the value of the recovered key length. but if the cipher is a fixed length cipher, then the recovered key length must match the fixed cipher length. no wiggle room, periodt π
β RETURN VALUES β
EVP_OpenInit()β returns0on error, or a non zero integer (and yeah, it's actually the recovered secret key size) if successful πEVP_OpenUpdate()β returns1for success or0for failure.EVP_OpenFinal()β returns0if the decrypt failed or1for success.
so likeβ¦ 0 means different things depending on which function you're in. read carefully bestie, i'm begging π
π SEE ALSO π
evp(7), RAND_bytes(3), EVP_EncryptInit(3), EVP_SealInit(3)
go read those too, iykyk π§
π 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 π this was version 3.5.0, dated 2026-09-25, from the fine people at OpenSSL β EVP_OPENINIT(3ossl), signing off πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 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