示例#1
0
        public string encrypt(string inputStr)
        {
            string str = "";

            try
            {
                byte[] bytes   = Encoding.Unicode.GetBytes(inputStr);
                byte[] buffer2 = StreamCipher.Encode(this.aesNow, bytes, StreamCipher.ENCRYPT);
                str             = this.convertBytes2String(buffer2);
                this.CipherText = str;
            }
            catch (Exception exception)
            {
                Console.WriteLine("Error : " + exception);
            }
            return(str);
        }
示例#2
0
        public string decrypt(string inputStr)
        {
            string str = "";

            try
            {
                byte[] data    = this.convertHex2Bytes(inputStr);
                byte[] buffer2 = StreamCipher.Encode(this.aesNow, data, StreamCipher.DECRYPT);
                str            = Encoding.Unicode.GetString(buffer2);
                this.plainText = str;
            }
            catch (Exception exception)
            {
                Console.WriteLine("Error : " + exception);
            }
            return(str);
        }