简体   繁体   中英

How to check for an encrption for a 7z file?

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM