这是我的C#代码。我该如何在Perl中解密呢?还是由于OpenSSL我无法在Perl中还原它?

RijndaelManaged RijndaelAlg = new RijndaelManaged();
FileStream fStream = File.Open(FileName, FileMode.OpenOrCreate);
byte[] initVectorBytes = Encoding.ASCII.GetBytes("11B2c3D4e5F6g7H8");
RijndaelAlg.IV = initVectorBytes;
string password = "11111111";
Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(password, Encoding.ASCII.GetBytes("22222222"));
RijndaelAlg.Key = key.GetBytes(RijndaelAlg.KeySize / 8);
fStream = File.Open(FileName, FileMode.OpenOrCreate);
cStream = new CryptoStream(fStream, RijndaelAlg.CreateEncryptor(RijndaelAlg.Key, RijndaelAlg.IV), CryptoStreamMode.Write);
StreamWriter sWriter = new StreamWriter(cStream);
sWriter.Write(input);

sWriter.Close();
cStream.Close();
fStream.Close();


非常感谢。

最佳答案

看一下Crypt :: OpenSSL :: AES。

当然,您的Perl代码将需要以某种方式获得正确的密钥。

07-25 20:38