Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How key_derivation and key_verification functions are implemented of a 7-zip archive's encryption mechanism?

I am curious about how password recovery works for password protected files. And I want to know the exact flow of the 7-zip encryption mechanism.

7-zip uses AES-256 encryption algorithm in CBC mode, to encrypt files or a folder. The key is generated from user supplied pass-phrase based on SHA-256 hash function. The SHA-256 is executed 219 (524,288) times to increase the cost of exhaustive search. Also, to help reduce the risk of dictionary attacks, salt is appended to original pass-phrase before generating hash.

My First question is how does key_derivation function work to generate a 256-bit key ? What is importance of IV for AES CBC mode and how it is generated?

My second and most important question is how key is verified to decrypt the 7-zip archive ? I mean how does its key_verification function work ?

like image 201
Gopal Avatar asked Sep 18 '12 04:09

Gopal


People also ask

Which encryption method should be used to encrypt data at rest with 7-Zip?

You can compress and encrypt archives with 7-Zip with AES-256 encryption.

How does 7Zip encrypt?

In the "Archive" field, enter the name of the file or archive you want created. From the "Archive format" field, select zip. Under the "Encryption" section, enter a strong password or passphrase in the "Enter passphrase" field and again in the "Reenter passphrase" field. Ensure the "Encryption method" is AES-256.

What is the encryption algorithm used to encrypt the zip file?

zip or . zipx): AES encryption: AES is the Advanced Encryption Standard, which is the result of a three-year competition sponsored by the U.S. Government's National Institute of Standards (NIST). This encryption method, also known as Rijndael, has been adopted by NIST as a Federal Information Processing Standard.

Does 7Zip support encryption?

7-Zip is a free file compression program that also allows you to encrypt and password protect the files you compress. You can compress multiple files into a single archive file. For someone to open an encrypted file created with 7-Zip that person will need to have 7-Zip or a compatible program.


1 Answers

The key derivation function is in the source of file 7zAes.cpp, it's called:

void CKeyInfo::CalculateDigest()

and it creates the key using a proprietary (rather dull) mechanism.

I haven't been able to find the key_verification method yet, if it exists. I'll let you know if I do find it.

like image 61
Maarten Bodewes Avatar answered Nov 05 '22 17:11

Maarten Bodewes