public void Encrypt(IUser user) { if (IsEncrypt) { return; } if (!IsDownloaded) { throw new ArgumentException("An undownloaded message cannot encrypt"); } if (!user.IsAuthorized) { throw new ArgumentException("User is unauthorized, message cannot encrypt"); } ISecureManager secureManager = ModulesManager.GetModulesManager().GetSecureManager(); string password = secureManager.DecryptWithAes(user.EncryptedPassword); if (type != StashMessageType.Empty) { content = secureManager.EncryptWithAesHmac(content, password); } IsEncrypt = true; }