I am struggling with decompression of a Zlib compressed Mime body of AS2 request coming from BizTalk Server.
The thing is:
The HTTP Body I receive looks as expected. I can read the ASCII encoded Mime Header:
"Content-type: application/pkcs7-mime; smime-type=compressed-data; name=smime.p7m\r\nContent-Transfer-Encoding: binary\r\n\r\n"
Ending with two line breaks, I am expecting the compressed body after. But when I use Ionic.Zlib ZlibStream.UncompressBuffer() to decompress the following bytes it throws an error.
Zlib Header can be identified for example by hex coded bytes "78da". When I start decompressing it from there on, it works fine.
What are the bytes between the two line breaks ending mime header and "78da" starting zlib compressed data?
"3080060b2a864886f70d0109100109a0803080020100300f060b2a864886f70d01091003080500308006092a864886f70d010701a080248004820769"
Next problem, if I read all bytes to the end, the last bytes can not be decompressed. AS far as I Understood the zLib data should end with adler32 checksum, but how can I identify the end or length of the compressed data without trying to decompress. I see some trailing bytes after the sucessfully decompressed data: "1f9b1f1fcbc51f0482000445a59371" What is that?
Thanks for your ideas!