EVP_EncryptInit

Initialize ctx for encryption with cipher, key, and iv.

Synopsis

Declared in <openssl/evp.h>

int
EVP_EncryptInit(
    EVP_CIPHER_CTX* ctx,
    EVP_CIPHER const* cipher,
    unsigned char const* key,
    unsigned char const* iv);

Return Value

1 on success, or 0 on failure.

Parameters

NameDescription
ctxCipher context to initialize (must already be allocated).
cipherCipher algorithm, or NULL to reuse the previous cipher while setting a new key/IV.
keyEncryption key bytes, or NULL to set the cipher without a key yet.
ivInitialization vector, or NULL when the cipher does not use an IV or the IV is set later.