Derive a cipher key and IV from a password using the legacy EVP_BytesToKey KDF.

Synopsis

Declared in <openssl/evp.h>

int
EVP_BytesToKey(
    EVP_CIPHER const* type,
    EVP_MD const* md,
    unsigned char const* salt,
    unsigned char const* data,
    int datal,
    int count,
    unsigned char* key,
    unsigned char* iv);

Return Value

Length of the derived key in bytes, or 0 on error.

Parameters

Name

Description

type

Cipher whose key and IV lengths determine the output sizes.

md

Digest used in the iterative key derivation (commonly EVP_md5()).

salt

Optional 8‐byte salt, or NULL.

data

Password / passphrase bytes.

datal

Length of data in bytes.

count

Iteration count (higher slows brute‐force attacks).

key

Output buffer for the derived key, or NULL to skip.

iv

Output buffer for the derived IV, or NULL to skip.

Created with MrDocs