public static int ProcessGet(string host, string id, string flag)
{
log.Info("Processing Vuln2.Get");
var state = JsonHelper.ParseJson<Vuln2State>(Convert.FromBase64String(id));
log.InfoFormat("Looking for Election {0}", state.ElectionId);
var election = ElectroClient.FindElection(host, Program.PORT, state.Voter.Cookies, state.ElectionId);
if(election == null)
throw new ServiceException(ExitCode.CORRUPT, string.Format("Can't find election '{0}'", id));
log.InfoFormat("Election {0} found", state.ElectionId);
var gotFlag = ExtractFlag(election, state.PrivateKey, flag.Length);
if(flag != gotFlag)
throw new ServiceException(ExitCode.CORRUPT, string.Format("Invalid flag! Got '{0}' instead of expected '{1}'", gotFlag, flag));
log.Info("Flag found! OK");
return (int)ExitCode.OK;
}