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

 

Vasiliy!

Did you get an answer?

 
Not yet. I think they will read this thread and reply right here. Waiting.
 
Please form a clear list of questions.

The function works with a separate data buffer, not with archive files.
The deflate algorithm is used, and the function was introduced to be used in WebRequest, in case the response is reaped by the server.

The key parameter is not used.
 
mql5:
Please form a clear list of questions.

The function works with the individual data buffer, not the archive files.
The deflate algorithm is used, and the function was introduced to be used in WebRequest, in case the response is fried by the server.

The key parameter is not used.

Good afternoon!

One question, what do the 4 bytes at the end of theCryptEncode() with the CRYPT_ARCH_ZIP parameter mean?

If you use thedeflate algorithm, you can also decompress ZIP archives knowing how you get those 4 bytes.

( Example ZIP decompiler on page 6)

 
Mikalas:

Good afternoon!

One question, what do the 4 bytes at the end of theCryptEncode() with the CRYPT_ARCH_ZIP parameter mean?

This is for integrity control, ADLER32 or CRC32 (it depends on the archiving parameters (Adler32 is always used in MQL) and can be missing) from the source data
 
and the first 2 bytes?
 
sanyooooook:
but the first 2 bytes?

Most likely it is:

0x78 - sign of packed data

0x5E - compression method

These bytes do not change (I checked)

 
mql5:
This is for integrity control, ADLER32 or CRC32 (may not exist) from the source data

Thank you.

ZIP without 4 bytes and CRC32 from ZIP archive is not unpacked :(

Vasiliy, our venture won't work

Unless, of course, the guys from MQ meet us halfway and add a flag to

functionCryptDecode(CRYPT_ARCH_ZIP, data, key, result,NO_READ_CRC) ;

or take CRC32 from the ZIP file:

CryptDecode(CRYPT_ARCH_ZIP, data, key, result,USE_CRC_FROM_ZIP) ;

struct ZIP_HEADER
{
  uint   sign;
  ushort a_version;
  ushort bit_flag;
  ushort comp_method;
  ushort last_mod_time;
  ushort last_mod_date;
  //uint   crc_32;
  uchar  ll_crc;
  uchar  lh_crc;
  uchar  hl_crc;
  uchar  hh_crc;
  uint   pack_size;
  uint   unpack_size;
  ushort fn_len;
  ushort extr_field_len;
};
 
Mikalas:

Thank you.

ZIP without 4 bytes and CRC32 from ZIP archive is not unpacked :(

Vasily, our idea will not work.

Unless, of course, the guys from MQ will meet us halfway and add a flag in

functionCryptDecode(CRYPT_ARCH_ZIP, data, key, result,NO_READ_CRC) ;

Can we try to slip in an empty four bytes?

mql5:
This is for integrity control, ADLER32 or CRC32 (depends on the archiving parameters (MQL always uses Adler32) and may not) of the source data
 
C-4:

Maybe try slipping in an empty four bytes?

I tried without the last 4 bytes and with the last 4 bytes "0" - it doesn't work :(
Reason: