title: Decrypting and Decompressing Data from Azure Blob Storage using C#
body: <p>I am using following code to Encrypt and Compress the Data before uploading to Azure Blob Storage</p>
  <pre><code>           //calling the API for Data
              var response = httpclient.Send(webRequest);
  
             //Compressing 
              using MemoryStream compressedMemoryStream = new MemoryStream();
              using (Stream bodyStream = response.Content.ReadAsStream())
              {
                  using (GZipStream compressionStream = new GZipStream(compressedMemoryStream,
                  CompressionMode.Compress, true))
                  {
                      await bodyStream.CopyToAsync(compressionStream);
                  }
              }
              compressedMemoryStream.Position = 0;
  
              //Uploading to blob 
              //options includes the details about encrypting
              blob.UploadFromStream(compressedMemoryStream, compressedMemoryStream.Length, null, options, null);
  
  </code></pre>
  <p>With this Data is being uploaded successfully to Azure Blob</p>
  <p>But I when try to download -&gt; decrypt -&gt; decompress it is giving me empty data</p>
  <p>Code below</p>
  <pre><code>            
              var compressedStream = new MemoryStream();
  
              //Download and decrypt Blob data to MemoryStream
              dblob.DownloadToStream(compressedStream, null, doptions, null);
  
             //Decompress Code
              var bigStream = new GZipStream(compressedStream, CompressionMode.Decompress);
              var bigStreamOut = new MemoryStream();
              bigStream.CopyTo(bigStreamOut);
              output = Encoding.UTF8.GetString(bigStreamOut.ToArray());
              
  
              // “output is empty&quot;.
              Console.WriteLine(output);
  
  </code></pre>