EVP_CipherInit

Initialize ctx for encryption or decryption using the default implementation.

Synopsis

Declared in <openssl/evp.h>

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

Return Value

1 on success, or 0 on failure.

Parameters

NameDescription
ctxCipher context to initialize.
cipherCipher algorithm, or NULL to reuse the current algorithm.
keyKey bytes, or NULL to set later.
ivInitialization vector, or NULL when not required / set later.
encNon-zero to encrypt, zero to decrypt.