title: Convert QR decoding solution from Python to C# (EU DGC)
body: <p>I am trying to convert this Python code to C# (.NET Core ideally).
  <a href="https://hackernoon.com/how-to-decode-your-own-eu-vaccination-green-pass-with-a-few-lines-of-python-9v2c37s1" rel="nofollow noreferrer">Source</a></p>
  <p>My goal is to convert the QR input string to another string containing the data in json. See the provided links.</p>
  <pre class="lang-py prettyprint-override"><code>#! /usr/bin/env python3
  import json
  import sys
  import zlib
   
  import base45
  import cbor2
  from cose.messages import CoseMessage
   
  payload = sys.argv[1][4:]
  print(&quot;decoding payload: &quot;+ payload)
   
  # decode Base45 (remove HC1: prefix)
  decoded = base45.b45decode(payload)
   
  # decompress using zlib
  decompressed = zlib.decompress(decoded)
  # decode COSE message (no signature verification done)
  cose = CoseMessage.decode(decompressed)
  # decode the CBOR encoded payload and print as json
  print(json.dumps(cbor2.loads(cose.payload), indent=2))
  </code></pre>
  <p>I couldn't find any NuGet package for <strong>Zlib</strong>, that would work correctly. So I am stuck straight after base45 decoding. Thanks for any tips.</p>
  <pre><code>using System.Text; //Rystem.Text.Base45 NuGet
      
  var removedHeader = testQrData.Substring(4);
  var decoded = removedHeader.FromBase45();
  byte[] rawBytes = Encoding.ASCII.GetBytes(decoded);
  </code></pre>
  <p>This <a href="https://ehealth.vyncke.org/index.php!" rel="nofollow noreferrer">link</a> might be helpful for further investigation.</p>
  <p><a href="https://i.stack.imgur.com/f79DC.png" rel="nofollow noreferrer">Decoding scheme</a></p>