commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: compress - 3 questions about encryption
Date Fri, 17 Sep 2010 12:58:33 GMT
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: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message