commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bamford <cbamf...@mimecast.com>
Subject compress - 3 questions about encryption
Date Fri, 17 Sep 2010 11:45:51 GMT
Hi,

I hope someone can advise me.
I am developing Java code to handle archives using commons compress and am currently focusing
on ZIP files.  I understand that ZIPs can be encrypted in two ways:

   (a) the contained entries can be plain text or encrypted
   (b) the whole ZIP itself can be encrypted

QUESTION 1:  Is this correct?  
If so, I need to be able to detect both.  So far I only know how to handle (a), by using this
method:

    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?

QUESTION 3: what is the right way to detect that the ZIP itself is encrypted?

Thanks,

- Chris


Chris Bamford


2 - 8 Balfe Street
Kings Cross,
London, N1 9EG

mobile 
tel: +44 (0) 207 843 2300
web www.mimecast.com


The information contained in this communication from cbamford@mimecast.com is confidential
and may be legally privileged. It is intended solely for use by user@commons.apache.org and
others authorized to receive it. If you are not user@commons.apache.org you are hereby notified
that any disclosure, copying, distribution or taking action in reliance of the contents of
this information is strictly prohibited and may be unlawful.


Mimecast Ltd. is a company registered in England and Wales with the company number 4698693
VAT No. GB 832 5179 29
Registered Office: 17 Heathman’s Road London, England, SW6 4TJ Email Address: info@mimecast.com

This email message has been scanned for viruses by Mimecast.
Mimecast delivers a complete managed email solution from a single web based platform.
For more information please visit http://www.mimecast.com
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message