On 2010-09-17, Stefan Bodewig wrote:
> On 2010-09-17, Chris Bamford wrote:
>> public boolean checkZipEntryIsEncrypted(ZipArchiveEntry entry) {
>> boolean encrypted = false;
>> // Check if zip file is encrypted
>> if (zfile != null) {
>> if (! zfile.canReadEntryData(entry)) {
>> encrypted = true;
>> }
>> }
>> return encrypted;
>> }
>> QUESTION 2: is this the right way to detect encrypted entries?
> encryption is one of the reasons canReadEntryData may return false,
> another reason could be an unsupported compression algorithm.
maybe I should have told you how to do it correctly?
entry.getGeneralPurposeBit().usesEncryption() will tell you whether an
entry is encrypted - no matter whether it uses the old weak-encryption
mechanism or the more modern approach.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]