EVP_CipherInit_ex

Initialise ctx for encryption or decryption with cipher.

Synopsis

Declared in <openssl/evp.h>

int
EVP_CipherInit_ex(
    EVP_CIPHER_CTX* ctx,
    EVP_CIPHER const* cipher,
    ENGINE* impl,
    unsigned char const* key,
    unsigned char const* iv,
    int enc);

Return Value

1 on success, or 0 on error.

Parameters

NameDescription
ctxCipher context to initialise.
cipherCipher algorithm, or NULL to keep the current cipher and change key/IV/dir.
implLegacy ENGINE, or NULL for the default implementation.
keyRaw key bytes, or NULL to set later.
ivIV/nonce bytes, or NULL when not required / set later.
enc1 to encrypt, 0 to decrypt, or -1 to leave the direction unchanged.