Exemplo n.º 1
0
        public void Encrypt(ICryptoTransform crypto)
        {
            if (crypto == null)
            {
                throw new ArgumentNullException("crypto");
            }
            long instanceId;

            if (crypto.Encrypt(this.Bytes, out instanceId))
            {
                this.InstanceId = instanceId;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// AES加密
        /// </summary>
        /// <param name="clearText">明文</param>
        /// <returns></returns>
        public string Encrypt(string clearText)
        {
            ICryptoTransform encryptor = Aes.CreateEncryptor();

            return(encryptor.Encrypt(clearText));
        }