private void CreateRevList() { var revList = new RevocationList { IssuerName = _userName, LastUpdated = DateTime.Today, NextUpdate = DateTime.Today.AddDays(1), }; var hashed = Sha256.HashSha256(JsonConvert.SerializeObject(revList)); revList.SignedHash = hashed; //hash revlist var data = JsonConvert.SerializeObject(revList); file.WriteToDir(_userName, data, "RevList"); }
public bool VerifyRevList(RevocationList list) { try { var hash = list.SignedHash; list.SignedHash = string.Empty; string serializedJson = JsonConvert.SerializeObject(list); var reHash = Sha256.HashSha256(serializedJson); if (hash != reHash) { Console.WriteLine("Revocation list was altered."); return(false); } return(true); } catch { Console.WriteLine("Revocation list was altered. "); return(false); } }