さて、私はファイルを復号化するためのこのコードを持っています
    public static byte[] DecryptFile(string inputFile, string skey)
    {
        RijndaelManaged aes = new RijndaelManaged();
            byte[] key = ASCIIEncoding.UTF8.GetBytes(skey);
            using (FileStream fsCrypt = new FileStream(inputFile, FileMode.Open))
            {
                using (CryptoStream cs = 
    new CryptoStream(fsCrypt, aes.CreateDecryptor(key, key),
    CryptoStreamMode.Read))
                {
                    using (BinaryReader reader = new BinaryReader(cs))
                    {
                        byte[] str = reader.ReadBytes(Convert.ToInt32(cs.Length));
                        reader.Close();
                        cs.Close();
                        return (str);
                    }
                }
            }
        }
    }
今、私はそれに問題があります、私はバイト長を決定することができません!私は試した
cs.Length
しかし、 Streamはシークをサポートしていないと言っています(thtのようなもの)私もファイルのバイトを数えてみました
File.ReadAllBytes(encrypted_file_path).Length
しかし、それはファイルが使用中であると言っています...それはFileStreamfsCryptのために実際に使用されています
その間、私はcs.Lengthそれを機能させるためにいくつかの大きな整数に置き換えました..1000000のように..例外を引き起こさない最大の整数..それはそのように機能します。