public void VerifyCert() { _verify = new VerifyCertAndList(); var files = Directory.EnumerateFiles(userPath); List <string> certFiles = new List <string>(); foreach (var thing in files) { if (thing.ToUpper().EndsWith("CERT.TXT")) { certFiles.Add(thing); } } if (certFiles.Count != 0) { foreach (var thing in certFiles) { var fText = File.ReadAllText(thing); var file = JsonConvert.DeserializeObject <Certificate>(fText); Console.WriteLine(file.SubjectName); } Console.Write("Enter the name of the cert you would like to verify or type all to verify all: "); var choice = Console.ReadLine(); if (choice.ToUpper() == "ALL") { foreach (var thing in certFiles) { var fText = File.ReadAllText(thing); var file = JsonConvert.DeserializeObject <Certificate>(fText); if (!_verify.VerifyCert(file, data.publicKey)) { revList = new AddCertToRevList(_userName, file); } else { Console.WriteLine($"{file.CertID} is still valid. "); } } } else { foreach (var thing in certFiles) { var fText = File.ReadAllText(thing); var file = JsonConvert.DeserializeObject <Certificate>(fText); if (file.SubjectName.ToUpper() == choice.ToUpper()) { if (!_verify.VerifyCert(file, data.publicKey)) { revList = new AddCertToRevList(_userName, file); } else { Console.WriteLine($"{file.CertID} is still valid. "); } } } } } }
//makes call to verifyrevocationlist public void VerifyRevList() { _verify = new VerifyCertAndList(); var files = Directory.EnumerateFiles(userPath); foreach (var thing in files) { if (thing.ToUpper().EndsWith("REVLIST.TXT")) { var fText = File.ReadAllText(thing); var file = JsonConvert.DeserializeObject <RevocationList>(fText); if (_verify.VerifyRevList(file)) { Console.WriteLine("List was not mutated in anyway"); } } } }