我有一个PDF文件。
当我想使用下面的代码对其进行加密时,Length of the data to encrypt is invalid.发生了错误:
string inputFile = @"C:\sample.pdf";
string outputFile = @"C:\sample_enc.pdf";
try
{
using (RijndaelManaged aes = new RijndaelManaged())
{
byte[] key = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
byte[] iv = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
aes.Key = key;
aes.IV = iv;
aes.Mode = CipherMode.CFB;
aes.Padding …Run Code Online (Sandbox Code Playgroud)