コード例 #1
0
        public void Decrypt(IUser user)
        {
            if (!IsEncrypt)
            {
                return;
            }

            if (!IsDownloaded)
            {
                throw new ArgumentException("An undownloaded message cannot decrypt");
            }

            if (!user.IsAuthorized)
            {
                throw new ArgumentException("User is unauthorized, message cannot decrypt");
            }

            ISecureManager secureManager = ModulesManager.GetModulesManager().GetSecureManager();

            string password = secureManager.DecryptWithAes(user.EncryptedPassword);

            if (type != StashMessageType.Empty)
            {
                content = secureManager.DecryptWithAesHmac(content, password);
            }

            IsEncrypt = false;
        }