コード例 #1
0
        public void Decrypt(Stream output)
        {
            byte[] buffer = new byte[source.Length];
            source.Read(buffer, 0, (int)source.Length);
            string ciphered      = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
            string base64Encoded = Cipher2.Decrypt(ciphered, pwd);

            byte[] bytes = Convert.FromBase64String(base64Encoded);
            for (int i = 0; i < bytes.Length; i++)
            {
                output.WriteByte(bytes[i]);
            }
        }
コード例 #2
0
        public void Encrypt(Stream output)
        {
            byte[] bytes = new byte[source.Length];
            source.Read(bytes, 0, (int)source.Length);
            string s        = Convert.ToBase64String(bytes);
            string ciphered = Cipher2.Encrypt(s, pwd);

            byte[] cipheredBytes = Encoding.UTF8.GetBytes(ciphered);
            for (int i = 0; i < cipheredBytes.Length; i++)
            {
                output.WriteByte(cipheredBytes[i]);
            }
        }