How to generate the initialization vector (IV) for the key derivation algorithm PBKDF2? #21457
Unanswered
ankitbhalla14
asked this question in
Q&A
Replies: 1 comment
-
When Here's a sample working program in C: Program
Output
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use the openssl command to encrypt and use the password based approach to generate the key/IV:
Command:
openssl enc -aes-256-cbc -in input1 -out output1 -pass pass:password -nosalt -pbkdf2 -p
Output of command:
key=E11244295150E6713CD76E9A5112347093BDB6ACBF0C8021ABAE29881130B210
iv =6B7F0C406297F0D90E3BD65AD1FB94BA
How to generate the same IV (matching with openssl command) through openssl code?
Note: I am able to generate the key exactly same but not able to generate the IV as same.
I used below call to generate the key from PBKDF2 algorithm:
PKCS5_PBKDF2_HMAC(reinterpret_cast<const char*>(password.c_str()), -1, nullptr, 0, 10000, EVP_sha256(), keyLength, key);
I am using openssl v 1.1.1
Beta Was this translation helpful? Give feedback.
All reactions