I am new to cryptography and have been experimenting with AES to encrypt files. I was testing some code I found online which allows the user to enter the directory of the files that they went to encrypt/decrypt, the program then asks for the user to input the “password” or “key” to be used for the encryption/decryption.
My problem is that I accidently inputted the wrong password/key when I was trying to decrypt the file, and as I hadn’t added a way for the program to detect incorrect passwords it tried to decrypt the file and so I was left with a file that was still in an encrypted/corrupted state.
I am wondering if it is possible to recover the original encrypted file. I now know the correct password that I should have first used to decrypt the file as well as the incorrect password that was used.
I have found another page where a user had a similar problem here Repair AES-128 decrypted file however this user did not specify that they knew the “correct” password that would have worked for the decryption, whereas I do.
The encryption function used in the script used a random IV as well as AES mode CBC.
Any help appreciated thanks