public void SetEncryptionKey(string newKey) { if (settings == null) { settings = new Model.EncryptionSettings(); } settings.EncryptionKey = newKey; SaveKey(); }
private void LoadKey() { string baseDirectory = (string)AppDomain.CurrentDomain.GetData("DataDirectory"); if (string.IsNullOrEmpty(baseDirectory)) baseDirectory = AppDomain.CurrentDomain.BaseDirectory; var settingsPath = baseDirectory + "/encryption.config"; if (System.IO.File.Exists(settingsPath) == true) { var data = System.IO.File.ReadAllText(settingsPath); settings = JsonConvert.DeserializeObject<Model.EncryptionSettings>(data); } if (settings == null) { settings = new Model.EncryptionSettings(); } }