openssl create Pbkdf2 key derivation

Viewed 53

I want to derivate a hashed password using the Pbkdf2 algorithm.

Input: Password, Salt, HashAlgorithm, IterationCount
Output: Hash

How to perform this with the openssl command line? I found https://www.openssl.org/docs/manmaster/man7/EVP_KDF-PBKDF2.html, so openssl should be able to do it, but I cannot find any docs on which command line to use.

1 Answers

You can use the OpenSSL "kdf" app to do this. You will need OpenSSL 3.0 for this (that app is not available in earlier versions).

See the man page here: https://www.openssl.org/docs/man3.0/man1/openssl-kdf.html

Example:

$ openssl kdf -keylen 32 -kdfopt digest:SHA256 -kdfopt pass:password -kdfopt salt:salt -kdfopt iter:10000 PBKDF2
5E:C0:2B:91:A4:B5:9C:6F:59:DD:5F:BE:4C:A6:49:EC:E4:FA:85:68:CD:B8:BA:36:CF:41:42:6E:88:05:52:2B
Related