PKCS5_PBKDF2_HMAC_SHA1

Derive a key from a password with PBKDF2-HMAC-SHA1 (RFC 2898).

Synopsis

Declared in <openssl/evp.h>

int
PKCS5_PBKDF2_HMAC_SHA1(
    char const* pass,
    int passlen,
    unsigned char const* salt,
    int saltlen,
    int iter,
    int keylen,
    unsigned char* out);

Return Value

1 on success, or 0 on failure.

Parameters

NameDescription
passPassword bytes, or NULL.
passlenLength of pass in bytes, or -1 to use strlen(pass).
saltSalt bytes, or NULL when saltlen is 0.
saltlenLength of salt in bytes.
iterIteration count (should be large; typically at least 1000).
keylenDesired derived key length in bytes.
outBuffer of at least keylen bytes that receives the derived key.