Дополнительные 16 байтов, генерируемые шифрованием C# AES - PullRequest
0 голосов
/ 17 февраля 2020

Я использую следующий код для проверки шифрования C# AES, и вывод составляет 32 байта вместо 16. Я хотел бы понять, что это за дополнительные 16 байтов. Большое спасибо за любую помощь.

using System;
using System.IO;
using System.IO.Compression;
using System.Security.Cryptography;
using System.Text;

namespace TestEnc
{
    class Program
    {
        static void Main(string[] args)
        {
            byte[] key = { 50, 41, 132,234,143,17,
                       89, 74,   2, 56, 36,87,
                       54, 87,  88, 28};

            byte[] iv = { 45, 241,153,24,14,17,
                       8, 57,32,5,96,47,
                       54,87,88,8};
            using (Rijndael algorithm = Rijndael.Create())
            {
                algorithm.Padding = PaddingMode.PKCS7;
                using (ICryptoTransform encryptor = algorithm.CreateEncryptor(key, iv))
                {
                    string fullpath = @"c:\test.txt";
                    using (Stream FileOutStream = File.Open(fullpath, FileMode.Create))
                    {
                        using (Stream encStream = new CryptoStream(FileOutStream, encryptor, CryptoStreamMode.Write))
                        {
                            string s = "hello world 1234";
                            for (int i = 0; i < 1; i++)
                            {
                                encStream.Write(Encoding.ASCII.GetBytes(s), 0, (int)s.Length);
                            }
                        }

                    }
                }
            }
        }
    }
}
...