How could I decrypt a file (encrypted with AES-128) using openssl ? I do not remember the passphrase I used to encrypt it, but I saved the key generated and used to encrypt my file. How could I use this key to decrypt my file ?

1 Answer 1


The quick answer is NO, you can not.
A detailed answer: On this official documentation, you can read:

When only the key is specified using the -K option, the IV must explicitly be defined. When a password is being specified using one of the other options, the IV is generated from this password.

IV stands for Initialization Vector. You can understand quickly how it is used with the combination of the key within CBC algorithm as shown on this figure:

CBC Mode Encryption

  • If you decrypt CBC with the wrong IV (e.g. all zeros) the first block (16 bytes for AES) is garbage but the rest is correct. Most (types of) computer files have low entropy in the first 4 bytes and often a few more, so guessing the first block isn't totally crazy. (The same would be true for CFB, which is rarely used, but not CTR, or CTR-based modes like GCM and CCM, or OFB.) Jul 19, 2014 at 5:06
  • 1
    @dave_thompson_085 You need either the valid password used to create the key, or a combination of the key with the correct IV (which thing is rather generated by encryption software, most of the time, so it is too difficult if not impossible to get it)
    – user45139
    Jul 19, 2014 at 6:58
  • When you logically reverse the (correct) figure you posted, you can see that the IV only affects decryption of the first block; decryption of all other blocks depends only on the key and the preceding ciphertext, which OP has. In the 1960's when modes like CBC and OFB were created, most crypto was done at a low level subject to bit errors, and "error [non]propagation" was an important feature; see en.wikipedia.org/wiki/… for a DIFFERENT mode that WOULD be unrecoverable without IV. Jul 23, 2014 at 7:00

You must log in to answer this question.