EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Windows ZIP folders

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#34192
Posted: 08/05/2015 04:01:33
by henk ten Hove (Standard support level)
Joined: 03/28/2014
Posts: 6

Hello,

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?

Code
procedure TTestConsultUitslag.TestZipCompress;
var Entry: TElZipArchiveDirectoryEntry;
  AZipper: TElZipWriter;
  AFileName: string;
begin
  DeleteFile('D:\VirtualBox\abc.zip');

  AZipper := TElZipWriter.Create(nil);
  try
    AZipper.CreateArchive;

    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);

    AZipper.Compress('D:\VirtualBox\abc.zip');
  finally
    AZipper.Free;
  end;
end;


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

Thank you for contacting us.

Most likely Windows doesn't support strong encryption. Please try to use TElZipWriter.WinZipEncryption instead.
#34200
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..

Thanks!
#34201
Posted: 08/06/2015 12:49:46
by Vsevolod Ievgiienko (EldoS Corp.)

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.

Reply

Statistics

Topic viewed 1357 times

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




|

Back to top

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

Got it!