public static SignedDGC VerifyData(String codeData) { try { // The base45 encoded data shoudl begin with HC1 if (codeData.StartsWith("HC1:")) { string base45CodedData = codeData.Substring(4); // Base 45 decode data byte[] base45DecodedData = Base45Decoding(Encoding.GetEncoding("UTF-8").GetBytes(base45CodedData)); // zlib decompression byte[] uncompressedData = ZlibDecompression(base45DecodedData); SignedDGC vacProof = new SignedDGC(); // Sign and encrypt data byte[] signedData = VerifySignedData(uncompressedData, vacProof); // Get json from CBOR representation of ProofCode EU_DGC eU_DGC = GetVaccinationProofFromCbor(signedData); vacProof.Dgc = eU_DGC; return(vacProof); } } catch (Exception e) { Console.WriteLine(e.ToString()); throw e; } return(null); }
protected static EU_DGC GetVaccinationProofFromCbor(byte[] cborData) { CBORObject cbor = CBORObject.DecodeFromBytes(cborData, CBOREncodeOptions.Default); EU_DGC vacProof = EU_DGC.FromJson(cbor.ToJSONString()); return(vacProof); }