public static LicenseDetails DecodeLicense(string fpath) { string str = File.ReadAllText(fpath); string[] parts = str.Split(new string[] { SIGNATURE_DELIM }, StringSplitOptions.None); if (parts.Length != 2) { throw new ApplicationException("Invalid license file"); } string signature = parts[0]; string data = parts[1]; // Verify the signature part bool ok = Verify(data, signature, _publicKey); if (!ok) { throw new ApplicationException("Invalid license file"); } // If the license passed signature verification - decode the data part. string decrypted = DecryptString(data); return(LicenseDetails.Parse(decrypted)); }