Open JJWR opened 9 years ago
I am not sure whether there is a better way to do it nor if it can be done without making some modification to the library, but maybe extracting some small file to memory, calculating CRC for extracted content and comparing it with CRC from header will be enough? If CRCs are equal == password is correct. If CRCs are different == incorrect password or damaged archive.
CRC is the only way to check. It's unfortunate but I don't think there's anyway to throw an exception or something unless there's an encrypted header to check.
CRC should anyway always be checked even if the file is not password protected to ensure that the file is all right. Is is not checked now?
I really haven't done much with CRC checking. I don't believe any of it is done currently.
@adamhathcock
When extracting rar file protected with password, files extracted done successfully when password is correct. how do i check the password correct or not? Tried above @Strachu CRC checking method. its not worked correctly in my file. @Strachu can you please explain it elaborately. If anyone knows some other method, please help
Hello, when I extract a rar file with password everything works as expected if the password is ok. However, when the password is wrong the extraction runs without raising any exception and the files are extracted. Of course the files are corrupted. This is the code I am using:
Since we can not ensure that the extraction went well, this issue is making the library useless for rar protected files.