Link to home
Start Free TrialLog in
Avatar of jbajaj
jbajaj

asked on

Decrypting gzip file

Hello

I am fetching an XML file form an external source which is encrypted using gzip, in my application

How can I decrypt it and extract the XMP out of it to parse it.

I am using .NET 3.5 with C#
Avatar of kaylanreilor
kaylanreilor
Flag of Luxembourg image

You could try to use ZLib through a C++ DLL called from your .Net assembly : http://www.codeproject.com/KB/security/CryptoLibCP.aspx.

Or, probably could you do it in 2 step:
1. unzip with System.IO.Compression.GZipStream class
2. decrypt using System.Security.Cryptography.RijndaelManaged class
http://www.obviex.com/samples/Encryption.aspx

I'm not 100% sure the second solution would work (let's give a try) but the first will in any cases.
Avatar of Mike_Mozhaev
Mike_Mozhaev

Hello,
Decompression can be performed by either GZipStream or DeflateStream classes depending on the format of compressed data.
As for extracting XMP you could load xml in XmlDocument and use SelectSingleNode() with XPath expression to find this node.
ASKER CERTIFIED SOLUTION
Avatar of Amandeep Singh Bhullar
Amandeep Singh Bhullar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Wait a minute, I thought we were talking about files encrypted with gzip and not only compressed. Else of course, it is far more easier.