0

I am encrypting my data using AES-128 CBC. However it is decrypted by another software CodeIgnitor, which actually converts password into 2 elements. HMAC key and encryption_key using hkdf and SHA-512 digest.

How can i implement this thing in my code. (I am using VB 6)

Re-phrasing my question: How is password converted into 2 elements HMAC_key and encryption_key?


Let's see if I can explain further..

Encryption software used is CryptoSys while decryptionis done by CodeIgnitor..which is not working

So the difference I can see between the two is that codeignitor is expecting an HMAC authmessage when decrypting while the encryption does not prepend it the final message. So how can i do that? I am using VB6 for encryption.


So far I have come to the conclusion that there could be 2 key-derivation function a pb-kdf or a h-kdf.

The h-kdf authentication in particular works as follows:

  1. A password is enterd by user
  2. Based on this password and a random IV, an HMAC key is generated using HKDF and SHA-512 digest algo.
  3. This HMAC key is saved and also expanded and then using IV/salt encrypts the plaintext message.
  4. The IV is pre-pended to the plain-text message and base64 encoded.
  5. The HMAC key is then pre-pended to the final message gereated in step 4.

So basically hkdf does not convert a key into 2 elements but only uses the basic key generated to generate other keys (and HMAC key is the original key used to generate other keys) now my question becomes...

Is there any vb6 library that uses hkdf and sha-512? As far as i have researched, Chilkat and CryptoSys APIs are only pbkdf based..Am I correct?

Samra
  • 1,815
  • 4
  • 35
  • 71
  • 3
    It is curious that the hash function used is SHA512 considering that the encryption algorithm used is AES-128. Normally SHA512 is used with AES-256 since it's natural output is 512 bits, leaving 256 bits for AES and 256 bits for the HMAC key. All of this aside, unless you know the paramters to the KDF, we can't really help. – Luke Joshua Park Aug 01 '17 at 02:41
  • i know the original password, plain text and the random IV but as explained in https://www.codeigniter.com/user_guide/libraries/encryption.html here i don't understand how they are generating SHA-512 HMAC authentication message and/or hmac key during encryption – Samra Aug 01 '17 at 05:05

0 Answers0