EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Windows ZIP folders

Posted: 08/05/2015 04:01:33
by henk ten Hove (Standard support level)
Joined: 03/28/2014
Posts: 6


We are creating a zipfile with the code as shown below. We can decompress the zip file with winzip and winrar but not with the standard windows zip folders. Since we (partly need to) rely on ZIP folders what would be the correct code to support that?

procedure TTestConsultUitslag.TestZipCompress;
var Entry: TElZipArchiveDirectoryEntry;
  AZipper: TElZipWriter;
  AFileName: string;

  AZipper := TElZipWriter.Create(nil);

    AZipper.CompressionAlgorithm := ZIP_COMPRESSION_DEFLATE;
    AZipper.CompressionLevel := 3; //Fast =1..
    AZipper.DirectoryCompressed := False;

    //PKWare Strong Encryption
    AZipper.Encrypt := True;
    AZipper.WinZipEncryption := False;
    AZipper.StrongEncryption := True;
    AZipper.StrongEncryptionInfo.EncryptionAlgorithm := ZIP_ENCRYPTION_AES256;
    AZipper.StrongEncryptionInfo.Use3DES := True;

    AZipper.Password := 'a';
    AZipper.ArchiveComment := 'Hello world';

    Entry := AZipper.Directory.EntryWithPath(GetDataPath);
    if not Assigned(Entry)
    then Entry := AZipper.Directory;

    AFileName := GetDataPath + 'files\file1.txt';
    AZipper.Add(Entry, AFileName);

    AFileName := GetDataPath + 'files\file2.txt';
    AZipper.Add(Entry, AFileName);


We are working with Delphi XE and secureblackbox #12.0.275
Posted: 08/05/2015 04:21:41
by Vsevolod Ievgiienko (Team)

Thank you for contacting us.

Most likely Windows doesn't support strong encryption. Please try to use TElZipWriter.WinZipEncryption instead.
Posted: 08/06/2015 11:04:01
by henk ten Hove (Standard support level)
Joined: 03/28/2014
Posts: 6

I tried it but it does not seem to work either. Even the delphi Sample Samples\Delphi\ZIPBlackbox\ZipArchiver\ZipArchiver.dproj seems to generate invalid files with the winzip(weak) or winzip-aes option. I'm unable to generate any valid file for windows zipfolders as far as i can tell..

Could you please test and confirm (or disconfirm) if this is also the case with you're samples..

Posted: 08/06/2015 12:49:46
by Vsevolod Ievgiienko (Team)

I've just checked that ZIP archives are opened correctly if Zip (weak) encryption is used. When you use ZipArchiver sample compression algorithm should be set to Deflate. Indeed AES encryption is not supported by Windows.



Topic viewed 1670 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!