CryptDecode with modifier CRYPT_ARCH_ZIP - How to use? - page 3

 
Mikalas:

Vasiliy!

Isn't the archive broken?

No, it's not. Made by me personally through 7zip for the test.

Sanya correctly noticed: CryptDecode decodes only compressed part of the archive, but how to make it decode this compressed part remains a mystery.

 

Upload

7zip and plain zip

Maybe 7zip is not supported?

 
Mikalas:

Upload

7zip and just zip

The packer is 7zip, the archive is zip. Other packers give the same result. You can check it by yourself. Take any file, pack it with any zip packer. Try to unpack the resulting archive (.zip) with CrypеDecode. - We will get an unpacking error. But the question is not even about the error of unpacking the whole archive, the question is how to configure CryptDecode to be able to unpack the packed partition from the zip archive.
 
C-4:
The packer is 7zip, the archive is zip. Other packers give the same result. You can check it yourself. Take any file, pack with any zip packer. Try to unpack the resulting archive (.zip) with CrypеDecode. - We will get an unpacking error. But the question is not even about the error of unpacking the whole archive, the question is how to configure CryptDecode to be able to unpack the packed partition from the zip archive.

:)

Your file won't open!

go to

if ( handle != INVALID_HANDLE )
 
C-4:
question how to configure CryptDecode to be able to decompress a packed partition from a zip archive.

might help

http://blog2k.ru/archives/3392

Чтение ZIP файла
  • 2014.06.04
  • Евгений Жирнов (jirnov@gmail.com)
  • blog2k.ru
Алгоритм получения данных из ZIP файла: находим запись EOCDзагружаем записи Central directory file headerдля каждой Central directory file header, находим и загружаем Local File Headerданные располагаются сразу после Local File Header, иногда размер данных записывается после самих данных в структуру Data descriptor, об этом сигнализирует флаг...
 

Vasiliy!

You didn't do it right, but it doesn't work right either :(

Unexpected internal error:

uchar array[];
   uchar key[];
   uchar result[];
   int handle = FileOpen( "test.zip", FILE_READ|FILE_BIN );
   if ( handle != INVALID_HANDLE )
   {
     uint array_size = FileReadArray( handle, array );
     FileClose( handle );
     
     Print( "Read totals: ", array_size );
     ArrayResize( key, array_size );
     for ( int i = 0; i < int( array_size ); i++ ) key[i] = 0;
     ResetLastError();
     int d = CryptDecode( CRYPT_ARCH_ZIP, array, key, result );
   
    if ( d < 1 )
     {
       Print( GetLastError() );
     } 
   }
 
Mikalas:

Vasiliy!

You didn't do it right, but it doesn't work either :(

I did it right. File doesn't open because it should be in COMMON directory, it's more convenient for me.

Key[] does not have to match source size.

sanyooooook:

might help

http://blog2k.ru/archives/3392

I can't invest in developing a class for reading zip unless I have documentation on hand and am confident that the CryptDecode function will properly unzip the compressed array. Handling the structure of a zip file is a trivial task. What I need to understand is why the regular zip's packed data doesn't match CryptDecode()'s. In other words, I need to know exactly why the zipped data doesn't match the packed data. In other words, you need to understand exactly why the yellow sections of the two files do not match:

 

And try creating a ZIP withCryptEncode(),

maybe MQ use their own encryption method similar to ZIP

 
Mikalas:

And try creating a ZIP withCryptEncode(),

maybe MQ use their own encryption method similar to ZIP

well, it does, and then it compares it to the output of the regular archiver
 
C-4:

I can't invest in developing a class to read a Zip unless I have documentation and confidence that the CryptDecode function will properly unzip the compressed array. Dealing with the structure of a zip file is a trivial task. What I need to understand is why the regular zip's packed data doesn't match CryptDecode()'s packed data. In other words, you need to understand exactly why the yellow sections of the two files do not match:

waiting for an answer from MQ would probably be faster )
Reason: