public void Lock() { Logger.Debug("Locking"); Logger.Debug("Perform encryption"); _lockedContent = _encryptionStrategy.Encrypt(Template, _container.GetContent()); Logger.Debug("lockedContent created"); Template = _encryptionStrategy.Encrypt(_lockedContent, Template); IsLocked = true; Logger.Debug("Locked"); }
public string Encrypt() { try { return(_strategy.Encrypt(_message)); } catch (NullReferenceException e) { System.Windows.Forms.MessageBox.Show("Strategy for encryption not set." + e.ToString(), "Strategy not set.", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, System.Windows.Forms.MessageBoxDefaultButton.Button1); return(null); } }
public bool SerializeObject(object o) { try { EnsureFolder(_configuration.StorageLocation); string json = JsonConvert.SerializeObject(o); string encrypted = _encryptionStrategy.Encrypt(json, _configuration.DecryptedMasterKey); WriteToFile(_configuration.GetFullPath(), encrypted, 0); return(true); } catch (Exception ex) { _logger.Error(ex.Message); } return(false); }
public void Send(string message) { var encryptedMessage = encryptionAlgorithm.Encrypt(message); Console.WriteLine($"Sending the encrypted message: {encryptedMessage}."); }
public string Encrypt(string content) { return(_strategy.Encrypt(content)); }