Closed olegfeferman closed 10 months ago
What does entry.Size say for the difference scenarios you test?
It reports correct size in bytes of that entry
I don't think you actually know if the password is correct until you try to decompress, that would give you a size, however it would be the wrong size / CRC, comparing the result with entry.Size would make more sense. Btw, when I try this with encrypted header info, it throw an exception, you might need to catch that if you have such files.
I tested your code snippet as a test with the archive "Rar.encrypted_filesOnly.rar". At least with that encrypted test file I got stream.Length
Thank you for the feedback. When I test with Rar.encrypted_filesAndHeader.rar or Rar.encrypted_filesOnly.rar it works OK (in first case I get exception in second stream.Length is greater than 0). What I did not realize before you sent your message is that I am only having problem with Rar5.encrypted_filesAndHeader.rar and Rar5.encrypted_filesOnly.rar. Actually before I was just testing with a test archive that I created with latest version of Winrar (6.23).
RAR5 decryption is a known TODO: https://github.com/adamhathcock/sharpcompress#todos-always-lots
Dup of https://github.com/adamhathcock/sharpcompress/issues/372
I didn't know. Thank you!
Hello,
I am trying to write a piece of code that verifies if user entered a correct password in case archive was password protected like this:
Problem is stream is always zero. Either it is a bug or I am doing something wrong.