public DecryptingModel (MainWindow controller) { this.controller = controller; publicKeyID = ConfigurationManager.AppSettings["publicKey"]; privateKeyID = ConfigurationManager.AppSettings["privateKey"]; publicKey = null; privateKey = null; }
public bool ProcessKey(string filePath) { using( StreamReader reader = new StreamReader(filePath) ) { string line = reader.ReadLine(); while(line != null) { string[] lineSplit = line.Split(new[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (lineSplit.Length == 2 && lineSplit[0].Trim().Equals(publicKeyID, StringComparison.OrdinalIgnoreCase)) { publicKey = new PublicKey(); string informationStr = ExtractInformation(lineSplit[1].Trim()); AddPublicInformation(informationStr); } else if (lineSplit.Length == 2 && lineSplit[0].Trim().Equals(privateKeyID, StringComparison.OrdinalIgnoreCase)) { privateKey = new PrivateKey(); string informationStr = ExtractInformation(lineSplit[1].Trim()); AddPrivateInformation(informationStr); } line = reader.ReadLine(); } } if( this.publicKey == null && this.privateKey == null ) { this.controller.SetStatus("Key File does not have ane key."); return false; } this.controller.SetStatus("Key processed successfully."); return true; }