-2

I need to check a 7z file for encryption.

I am using sevenzipjbind and using the property ENCRYPTED, but it seems it involves a lot more steps after that which I am not able to certain.

GhostCat
  • 137,827
  • 25
  • 176
  • 248
  • It involves a native method call , Can anyone look for it and help me please – Dheeraj K Sharma Sep 18 '18 at 16:58
  • 5
    Please provide your code with what you've tried so far. – avojak Sep 18 '18 at 17:03
  • Welcome to Stack Overflow! Other users marked your question for low quality and need for improvement. I re-worded/formatted your input to make it easier to read/understand. Please review my changes to ensure they reflect your intentions. But I think your question is still not answerable. **You** should [edit] your question now, to include your own efforts (see [help me is not a question](https://meta.stackoverflow.com/questions/284236/why-is-can-someone-help-me-not-an-actual-question) ). Feel free to drop me a comment in case you have further questions or feedback for me. – GhostCat Sep 19 '18 at 06:39

1 Answers1

0

You can use commons-compress which supports reading encrypted 7zip archives. From the official website:

The ar, arj, cpio, dump, tar, 7z and zip formats are supported as archivers where the zip implementation provides capabilities that go beyond the features found in java.util.zip. As of Commons Compress 1.18 support for the dump and arj formats is read-only - 7z can read most compressed and encrypted archives but only write unencrypted ones. LZMA(2) support in 7z requires XZ for Java as well.

Take a look at SevenZFile class to see if you can use it. Internally SevenZFile reads archive header to check the password.

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
  • 1
    Thanks for the link , but actually i want to just check if the 7z is encrypted or not , i dont want to read or extract a 7z file . can u please help me in that. – Dheeraj K Sharma Sep 19 '18 at 09:36